![](https://img.laitimes.com/img/__Qf2AjLwojIjJCLyojI0JCLicmbw5CZwcDM1QmZlFDZwI2Y2YWOkNTO0EjMhRjM5MWZxEWOz8CX5d2bs92Yl1iclB3bsVmdlR2LcNWaw9CXt92Yu4GZjlGbh5yYjV3Lc9CX6MHc0RHaiojIsJye.png)
錯誤消息:
main.ts:12 NullInjectorError: R3InjectorError(AppModule)[StoreFeatureModule -> ReducerManager -> ReducerManager -> ReducerManager]:
NullInjectorError: No provider for ReducerManager!
at NullInjector.get (http://localhost:4200/vendor.js:8310:27)
at R3Injector.get (http://localhost:4200/vendor.js:22317:33)
at injectInjectorOnly (http://localhost:4200/vendor.js:8165:33)
at Module.ɵɵinject (http://localhost:4200/vendor.js:8175:57)
at Object.StoreFeatureModule_Factory [as factory] (http://localhost:4200/vendor.js:64143:380)
at R3Injector.hydrate (http://localhost:4200/vendor.js:22555:63)
at R3Injector.get (http://localhost:4200/vendor.js:22305:33)
at http://localhost:4200/vendor.js:22351:25
根據這篇文章的提示:
https://www.manongdao.com/article-974354.htmlStoreModule.forRoot should only be called once in the root of your project NgModule. If you wan’t to register a feature, use StoreModule.forFeature. Using forRoot registers the global providers needed for Store.
在app module裡添加一行代碼即可解決: