我试图为一个Angular应用程序提供服务,但我从“ngx-mqtt”:“^6.6.0”中得到此依赖项错误。我的本地CLI是6.2.9版本。我试图更改此依赖项的版本,但我仍然得到此错误。我只是不知道为什么会发生这种情况。
错误in ./node_modules/ngx-mqtt/src/mqtt.service.js 390:34-55“在”@angular/core“中未找到导出"可定义的可注入”(导入为“i 0”)
错误in ./node_modules/ngx-mqtt/src/mqtt.service.js 390:126-137“在”@angular/core“中未找到导出”缓存注入“(导入为”i 0“)
错误in ./node_modules/ngx-mqtt/src/mqtt.service.js 390:161-172“在”@angular/core“中未找到导出”缓存注入“(导入为”i 0“)
这些是我对package.json的主要依赖
"dependencies": {
"@angular/animations": "^6.1.7",
"@angular/cdk": "^6.4.7",
"@angular/cli": "~6.2.1",
"@angular/common": "^6.1.0",
"@angular/compiler": "^6.1.0",
"@angular/compiler-cli": "^6.1.0",
"@angular/core": "^6.1.0",
"@angular/flex-layout": "^6.0.0-beta.18",
"@angular/forms": "^6.1.0",
"@angular/http": "^6.1.0",
"@angular/material": "^6.4.7",
"@angular/material-moment-adapter": "^6.4.7",
"@angular/platform-browser": "^6.1.0",
"@angular/platform-browser-dynamic": "^6.1.0",
"@angular/router": "^6.1.0",
"@fortawesome/angular-fontawesome": "^0.3.0",
"@fortawesome/fontawesome-svg-core": "^1.2.21",
"@fortawesome/free-regular-svg-icons": "^5.10.1",
"@fortawesome/free-solid-svg-icons": "^5.10.1",
...
个字符
2条答案
按热度按时间5vf7fwbs1#
从
"ngx-mqtt": "^6.6.0"
中删除字符^
解决了问题。5fjcxozz2#
当前项目angular版本Angular CLI:6.1.5 Node:14.17.2
1.删除节点模块文件夹
1.删除package-lock.json
1.编辑程序包
字符串
1.保存所有更改的文件后,运行npm i --legacy-peer-deps
5.run npm start
6.如果您收到以下警告
请参阅./node_modules/@agm/core/fesm 5/agm-core.js 4538:120-128“在”@angular/core“中未找到导出”可注入“请参阅./node_modules/@agm/core/fesm 5/agm-core.js 4538:34-52“在”@angular/core“中未找到导出”可注入定义“请参阅./node_modules/@ agm/core/fesm 5/agm-core. js 4538:34-52”编译时出现警告。
1.转到路径./node_modules/@agm/core/fesm 5/agm-core.js,打开agm-core.js文件,搜索“注入”,然后删除“ee”,并将其保留为“注入”搜索“注入defineInjectable”,删除“ee”,并将其保留为“defineInjectable”
8.save此更改的文件
1.再次运行npm start
1.它会工作
感谢大家