Angular 错误-请在使用rxjs compact后添加NgModule注释

Angular 错误-请在使用rxjs compact后添加NgModule注释,angular,Angular,安装npm安装后--保存rxjs compat 我在Angular 6应用程序中出错 错误: Uncaught Error: Unexpected value 'Observable' imported by the module 'AppModule'. Please add a @NgModule annotation. at syntaxError (compiler.js:1021) 我的应用程序模块-- package.json--- “依赖项”:{ “@angular/an

安装
npm安装后--保存rxjs compat

我在Angular 6应用程序中出错

错误:

Uncaught Error: Unexpected value 'Observable' imported by the module 'AppModule'. Please add a @NgModule annotation.
    at syntaxError (compiler.js:1021)
我的应用程序模块--

package.json--- “依赖项”:{ “@angular/animations”:“^6.1.0”, “@angular/common”:“^6.1.0”, “@angular/compiler”:“^6.1.0”, “@angular/core”:“^6.1.0”, “@angular/forms”:“^6.1.0”, “@angular/http”:“^6.1.0”, “@angular/platform浏览器”:“^6.1.0”, “@angular/platform browser dynamic”:“^6.1.0”, “@angular/router”:“^6.1.0”, “引导”:“^4.1.3”, “核心js”:“^2.5.4”, “字体真棒”:“^4.7.0”, “jquery”:“^3.3.1”, “rxjs”:“^6.3.2”, “rxjs compat”:“^6.3.2”, “zone.js”:“~0.8.26”
},

就像评论中提到的Omubek Kadyrbekov一样,您不应该将rxjs导入到您的模块中

在组件中,尝试精确导入:

import { Observable } from 'rxjs/Observable';
而不是你的

import { Observable, Subject } from 'rxjs';

欢迎来到SO,请给我们看一下你的app.module.ts代码。你不应该在模块中导入
可观察的,主题
。是的,我尝试过,但对我无效。它说-导入声明中的所有导入都未使用。根据,请提供完整的错误行。你真的用所有进口的东西吗?
import { Observable, Subject } from 'rxjs';