Angular运行错误:Module '"@ngrx/store"' has no exported member 'Environment Providers'.
今天运行一个基于angular做前端的应用程序时出错:
./node_modules/@ngrx/effects/fesm2015/ngrx-effects.mjs:846:15-37 - Error: export 'FEATURE_STATE_PROVIDER' (imported as 'FEATURE_STATE_PROVIDER') was not found in '@ngrx/store' (possible exports: ACTIVE_RUNTIME_CHECKS, ActionsSubject, FEATURE_REDUCERS, INIT, INITIAL_REDUCERS, INITIAL_STATE, META_REDUCERS, REDUCER_FACTORY, ReducerManager, ReducerManagerDispatcher, ReducerObservable, STORE_FEATURES, ScannedActionsSubject, State, StateObservable, Store, StoreFeatureModule, StoreModule, StoreRootModule, UPDATE, USER_PROVIDED_META_REDUCERS, USER_RUNTIME_CHECKS, combineReducers, compose, createAction, createActionGroup, createFeature, createFeatureSelector, createReducer, createReducerFactory, createSelector, createSelectorFactory, defaultMemoize, defaultStateFn, emptyProps, isNgrxMockEnvironment, on, props, reduceState, resultMemoize, select, setNgrxMockEnvironment, union) Error: node_modules/@ngrx/effects/src/provide_effects.d.ts:2:10 - error TS2305: Module '"@ngrx/store"' has no exported member 'EnvironmentProviders'. 2 import { EnvironmentProviders } from '@ngrx/store'; ~~~~~~~~~~~~~~~~~~~~ Error: node_modules/@ngrx/store-devtools/src/provide-store-devtools.d.ts:4:10 - error TS2305: Module '"@ngrx/store"' has no exported member 'EnvironmentProviders'. 4 import { EnvironmentProviders } from '@ngrx/store';
这是由于@ngrx/store
包版本太老的缘故
解决方法
打开package.json
文件,找到下面两参数修改为最新的即可
"@ngrx/store": "^14.3.2", "@ngrx/store-devtools": "^14.3.2",
NPM:https://www.npmjs.com/package/@ngrx/router-store