Angular2-通知在角度更新后对 zone.js 的依赖

问题描述 投票:0回答:1

我将 Angular 应用程序升级到 v16,运行 npm install 后出现以下错误。

npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/zone.js
npm ERR!   zone.js@"~0.13.0" from the root project
npm ERR!   peer zone.js@"~0.13.0" from @angular/[email protected]
npm ERR!   node_modules/@angular/core
npm ERR!     @angular/core@"^16.2.2" from the root project
npm ERR!     peer @angular/core@"16.2.2" from @angular/[email protected]
npm ERR!     node_modules/@angular/animations
npm ERR!       @angular/animations@"^16.2.2" from the root project
npm ERR!       2 more (@angular/material, @angular/platform-browser)
npm ERR!     18 more (@angular/cdk, @angular/common, @angular/compiler, ...)
npm ERR!   1 more (primeng)
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer zone.js@"^0.11.4" from [email protected]
npm ERR! node_modules/angular2-notifications
npm ERR!   angular2-notifications@"12.0.0" from the root project
npm ERR! 
npm ERR! Conflicting peer dependency: [email protected]
npm ERR! node_modules/zone.js
npm ERR!   peer zone.js@"^0.11.4" from [email protected]
npm ERR!   node_modules/angular2-notifications
npm ERR!     angular2-notifications@"12.0.0" from the root project

从错误中可以清楚地看出,Angular/core@16需要[email protected],而[email protected](12是最新版本)对[email protected]有对等依赖。由于 angular2-notifications 的版本已经满了,除了替换它还有其他方法来解决这个错误吗?

这是我的 package.json 中的依赖项和 devDependency 以供参考。

依赖关系

"@angular-devkit/core": "16.2.0",
"@angular/animations": "^16.2.2",
"@angular/cdk": "^16.2.1",
"@angular/common": "^16.2.2",
"@angular/compiler": "16.2.2",
"@angular/core": "^16.2.2",
"@angular/forms": "^16.2.2",
"@angular/localize": "^16.2.2",
"@angular/material": "^16.2.1",
"@angular/platform-browser": "^16.2.2",
"@angular/platform-browser-dynamic": "^16.2.2",
"@angular/router": "^16.2.2",
"@auth0/angular-jwt": "^2.1.2",
"@daymon-nes/daymon-usermanagement-client": "3.0.1",
"@ng-bootstrap/ng-bootstrap": "^15.1.1",
"@ng-select/ng-select": "^11.1.1",
"@ngx-translate/core": "^13.0.0",
"@ngx-translate/http-loader": "^6.0.0",
"@okta/okta-signin-widget": "6.3.0",
"@swimlane/ngx-datatable": "20.1.0",
"@types/base-64": "^0.1.2",
"@types/bootstrap": "^3.3.36",
"@types/jquery": "3.3.34",
"@types/node": "^12.11.1",
"angular2-notifications": "12.0.0",
"angular2-text-mask": "^9.0.0",
"base-64": "^0.1.0",
"bootstrap": "4.0.0-alpha.6",
"core-js": "^2.4.1",
"css-ripple-effect": "^1.0.5",
"file-saver": "^2.0.2",
"font-awesome": "^4.7.0",
"google-libphonenumber": "^3.2.6",
"html2canvas": "^1.0.0-rc.7",
"ionic-native": "2.2.11",
"jquery": "3.4.1",
"jspdf": "^2.4.0",
"knockout": "3.4.2",
"lato-font": "^3.0.0",
"libphonenumber-js": "^1.10.13",
"material-colors": "^1.2.5",
"material-design-iconic-font": "^2.2.0",
"messageformat": "^1.1.1",
"moment": "^2.20.1",
"multiple-date-picker-angular": "^3.0.0",
"ng2-date-picker": "^16.0.0",
"ng2-rx-componentdestroyed": "3.0.1",
"ngx-bootstrap": "^6.2.0",
"ngx-bootstrap-multiselect": "^4.0.0",
"ngx-infinite-scroll": "^10.0.0",
"ngx-mask": "^16.2.5",
"ngx-pagination": "^4.1.0",
"password-validator": "^4.1.1",
"popper": "^1.0.1",
"popper.js": "^1.12.9",
"primeng": "^16.1.0",
"prismjs": "^1.9.0",
"rimraf": "^2.6.2",
"rxjs": "^7.8.1",
"rxjs-compat": "^6.5.5",
"rxjs-tslint": "^0.1.8",
"string-mask": "^0.3.0",
"swimlane": "0.0.1",
"tether": "^1.3.7",
"tinymce": "^4.8.5",
"tslib": "^2.0.0",
"url": "^0.11.0",
"xlsx": "^0.17.3",
"zone.js": "~0.13.0"

开发依赖项

"@angular-devkit/build-angular": "^16.2.0",
"@angular/cli": "^16.2.0",
"@angular/compiler-cli": "16.2.2",
"@angular/language-service": "^16.2.2",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.2",
"@types/lodash": "4.14.116",
"codelyzer": "^6.0.0",
"jasmine-core": "~3.6.0",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.3.4",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"lodash": "^4.17.4",
"protractor": "~7.0.0",
"ts-node": "~3.2.0",
"tslint": "~6.1.0",
"typescript": "4.9.5"

感谢您的帮助/建议。

蒂亚

angular npm-install zone.js peer-dependencies
1个回答
0
投票

根据上述错误,[email protected]需要一个对等zone.js@“^0.11.4”。但是 [email protected] 尚未更新以兼容最新版本的 zone.js。为此,您可以使用替代通知模块,例如 angular-notifier

> npm i angular-notifier
© www.soinside.com 2019 - 2024. All rights reserved.