Angular 应用未编译
Angular App not compiling
我正在尝试创建一个简单的 Angular 应用程序,并且我正在尝试使用 ngrx
以便我可以使用状态。我最初在我的应用程序文件夹和 运行 命令 yarn add @ngrx/store
.
每当我尝试使用 app.module.ts
文件顶部的 import { StoreModule } from '@ngrx/store'
导入 StoreModule
时,我都会收到编译错误(如下所列)。
ERROR in node_modules/@ngrx/store/src/actions_subject.d.ts(2,10): error TS2305: Module '"...AngularProjects/ngrx-tut/node_modules/rxjs/BehaviorSubject"' has no exported member 'BehaviorSubject'.
node_modules/@ngrx/store/src/reducer_manager.d.ts(2,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/BehaviorSubject"' has no exported member 'BehaviorSubject'.
node_modules/@ngrx/store/src/reducer_manager.d.ts(3,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@ngrx/store/src/scanned_actions_subject.d.ts(2,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@ngrx/store/src/state.d.ts(2,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/BehaviorSubject"' has no exported member 'BehaviorSubject'.
node_modules/@ngrx/store/src/state.d.ts(3,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@ngrx/store/src/store.d.ts(2,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Observer"' has no exported member 'Observer'.
node_modules/@ngrx/store/src/store.d.ts(3,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@ngrx/store/src/store.d.ts(4,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Operator"' has no exported member 'Operator'.
node_modules/rxjs/BehaviorSubject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/BehaviorSubject'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
node_modules/rxjs/Observer.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observer'.
node_modules/rxjs/Operator.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Operator'.
node_modules/rxjs/Subject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subject'.
我能够 import { Action } from '@ngrx/store'
在不同的文件上并且我没有收到任何错误。
感谢任何帮助 and/or 评论!
编辑:
我包含了 import { Observable } from 'rxjs';
但我仍然遇到这些错误。
这是我在这个问题开头的依赖项:
Angular - 6.0.2 | rxjs - 6.1.0 | @ngrx/store - 1.X
我的问题是我的 @ngrx/store
在 1.X
上,而我所有的其他东西都在 6.X
上。我将 @ngrx/store 更新为 v6.0.0-beta.3,现在可以使用了。
I initially installed @ngrx/store using the yarn
command. Does that mean that using yarn will give everyone a v1.x verison by default? I hope not..
总之,谢谢大家的帮助!
我正在尝试创建一个简单的 Angular 应用程序,并且我正在尝试使用 ngrx
以便我可以使用状态。我最初在我的应用程序文件夹和 运行 命令 yarn add @ngrx/store
.
每当我尝试使用 app.module.ts
文件顶部的 import { StoreModule } from '@ngrx/store'
导入 StoreModule
时,我都会收到编译错误(如下所列)。
ERROR in node_modules/@ngrx/store/src/actions_subject.d.ts(2,10): error TS2305: Module '"...AngularProjects/ngrx-tut/node_modules/rxjs/BehaviorSubject"' has no exported member 'BehaviorSubject'.
node_modules/@ngrx/store/src/reducer_manager.d.ts(2,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/BehaviorSubject"' has no exported member 'BehaviorSubject'.
node_modules/@ngrx/store/src/reducer_manager.d.ts(3,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@ngrx/store/src/scanned_actions_subject.d.ts(2,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Subject"' has no exported member 'Subject'.
node_modules/@ngrx/store/src/state.d.ts(2,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/BehaviorSubject"' has no exported member 'BehaviorSubject'.
node_modules/@ngrx/store/src/state.d.ts(3,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@ngrx/store/src/store.d.ts(2,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Observer"' has no exported member 'Observer'.
node_modules/@ngrx/store/src/store.d.ts(3,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Observable"' has no exported member 'Observable'.
node_modules/@ngrx/store/src/store.d.ts(4,10): error TS2305: Module '".../AngularProjects/ngrx-tut/node_modules/rxjs/Operator"' has no exported member 'Operator'.
node_modules/rxjs/BehaviorSubject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/BehaviorSubject'.
node_modules/rxjs/Observable.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observable'.
node_modules/rxjs/Observer.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Observer'.
node_modules/rxjs/Operator.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Operator'.
node_modules/rxjs/Subject.d.ts(1,15): error TS2307: Cannot find module 'rxjs-compat/Subject'.
我能够 import { Action } from '@ngrx/store'
在不同的文件上并且我没有收到任何错误。
感谢任何帮助 and/or 评论!
编辑:
我包含了 import { Observable } from 'rxjs';
但我仍然遇到这些错误。
这是我在这个问题开头的依赖项:
Angular - 6.0.2 | rxjs - 6.1.0 | @ngrx/store - 1.X
我的问题是我的 @ngrx/store
在 1.X
上,而我所有的其他东西都在 6.X
上。我将 @ngrx/store 更新为 v6.0.0-beta.3,现在可以使用了。
I initially installed @ngrx/store using the
yarn
command. Does that mean that using yarn will give everyone a v1.x verison by default? I hope not..
总之,谢谢大家的帮助!