Angular No provider for EffectsRootModule错误消息的出现原因和修复方式
错误消息:
main.ts:12 NullInjectorError: R3InjectorError(AppModule)[EffectsFeatureModule -> EffectsRootModule -> EffectsRootModule -> EffectsRootModule]:
NullInjectorError: No provider for EffectsRootModule!
at NullInjector.get (http://localhost:4200/vendor.js:62758:27)
at R3Injector.get (http://localhost:4200/vendor.js:76765:33)
at R3Injector.get (http://localhost:4200/vendor.js:76765:33)
at R3Injector.get (http://localhost:4200/vendor.js:76765:33)
at injectInjectorOnly (http://localhost:4200/vendor.js:62613:33)
at Module.ɵɵinject (http://localhost:4200/vendor.js:62623:57)
at Object.EffectsFeatureModule_Factory [as factory] (http://localhost:4200/vendor.js:137576:239)
at R3Injector.hydrate (http://localhost:4200/vendor.js:77003:63)
at R3Injector.get (http://localhost:4200/vendor.js:76753:33)
at http://localhost:4200/vendor.js:76799:25
(anonymous) @ main.ts:12
invoke @ zone-evergreen.js:364
run @ zone-evergreen.js:123
(anonymous) @ zone-evergreen.js:857
invokeTask @ zone-evergreen.js:399
runTask @ zone-evergreen.js:167
drainMicroTaskQueue @ zone-evergreen.js:569
Promise.then (async)
scheduleMicroTask @ zone-evergreen.js:552
scheduleTask @ zone-evergreen.js:388
scheduleTask @ zone-evergreen.js:210
scheduleMicroTask @ zone-evergreen.js:230
scheduleResolveOrReject @ zone-evergreen.js:847
then @ zone-evergreen.js:979
bootstrapModule @ core.js:42679
./src/main.ts @ main.ts:11
webpack_require @ bootstrap:79
0 @ unless.directive.ts:33
webpack_require @ bootstrap:79
checkDeferredModules @ bootstrap:45
webpackJsonpCallback @ bootstrap:32
(anonymous) @ main.js:1
应用程序自己开发的module:
EffectsFeatureModule是dependent type之一:
value是null,所以报错:
在app.module.ts里加上一行语句即可解决问题:
EffectsModule.forRoot([AppEffects]),
这个forRoot方法为EffectsRootModule提供了可用的provider:
要获取更多Jerry的原创文章,请关注公众号"汪子熙":
Angular No provider for EffectsRootModule错误消息的出现原因和修复方式相关推荐
- Angular 服务器端渲染的一个错误消息 - No provider for InjectionToken REQUEST
错误消息: NullInjectorError: R3InjectorError(AppServerModule) WindowRef -> InjectionToken SERVER_REQU ...
- Angular开发遇到的一个错误消息 - Expected linebreak to be LF(和本地文件的换行设置有关)
(linebreak-style)tslint(1) 命令: ng test core --code-coverage console会不定期打印出单元测试执行结果: 最后2554个全部执行完毕. 在 ...
- Angular compiler报的一个错误消息:Component XX is not part of any NgModule
Error in /turbo_modules/@angular/compiler@9.1.12/bundles/compiler.umd.js (29363:23) Component Produc ...
- 如何处理Angular依赖注入的错误消息: NullInjectorError No provider for EffectsRootModule!
NullInjectorError: No provider for EffectsRootModule! 解决办法: 新建一个app.effect.ts: import { Injectable } ...
- 为什么按照 Angular 官网教程执行简单的测试代码,会遇到expect is not defined的错误消息
Angular 官网的代码: https://angular.io/api/core/Injectable#providedin 我把这段代码原封不动地拷贝到我的 app.module.ts ,然后执 ...
- Angular路由错误消息 - router-outlet is not a known element
我在application Component的HTML里定义了一个router-outlet元素: 遇到错误消息: router-outlet is not a known element 查看其定 ...
- Angular单元测试的一个错误消息
错误消息: 'expect' was used when there was no current spec, this could be because an asynchronous test t ...
- 如何处理Angular应用的错误消息: No pipe found with name async
错误消息: Failed to compile. src/app/ngrxdemo/container/component/counter/counter.component.html:8:27 - ...
- NgRx 和 Angular CLI 版本不一致的错误
我最近试图用 Angular Schematics 安装基于 Spartacus 4.0.1 的 Storefront,yarn install 之后执行 yarn start,遇到如下错误消息: E ...
最新文章
- 修改系统density适配
- oracle打补丁到11.2.0.3.4
- Android 实现Activity后台运行
- skip page cache - SAP gateway的调试
- 新装oracle密码文件,oracle密码文件的重建
- 常见的几款JVM监控工具
- 微软新版 Edge 浏览器叫板 Chrome!
- 最新容器项目 Kata 曝光
- OpenCV读取UsbCam的图像
- 系统架构师--考试大纲
- python对gif图压缩
- 计算机怎么设置本地硬盘启动,怎么设置移动硬盘启动
- Java实现微信公众号客服功能和本地联调
- linux系统fasta程序,fasta格式文件处理大全(一)
- 字节飞书前端三轮技术面+HR面
- 图像相似度对比-直方图
- 西瓜视频怎么下载视频?
- 《为什么99%的人不适合做区块链投资》
- ABB机器人基础培训资料整理与总结
- Unity云渲染开源框架UnityRenderStreaming使用说明
热门文章
- 跨域iframe的高度自适应
- Ubuntu 安装 Qt 开发环境(转)
- IDEA中使用Maven构建SSM项目
- Windows 8.1下安装Mac OS X 10.8虚拟机
- 工控机改装家庭智能中心--命令行配置无线wifi
- MUI - 解决bug: iphone页面保存时popPicker自动弹出来
- VMware-workstation-full-7.1.4-385536.exe
- 用盛金公式求解一元三次方程
- 仿VS窗体效果+outlookbar效果
- 前端请求,后台http 连接输出流交给ServeletResponse 下载文件