这是我的Angular 2应用程序的package.json最近看起来的样子:
"dependencies": {
"@angular/common": "~2.2.0",
"@angular/compiler": "~2.2.0",
"@angular/core": "~2.2.0",
"@angular/forms": "~2.2.0",
"@angular/http": "~2.2.0",
"@angular/platform-browser": "~2.2.0",
"@angular/platform-browser-dynamic": "~2.2.0",
"@angular/router": "~3.2.0",
"@angular/upgrade": "~2.2.0",
"angular-in-memory-web-api": "~0.1.5",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"systemjs": "0.19.40",
"zone.js": "^0.6.25",
"primeng": "^1.0.1",
"ng2-webstorage": "1.4.1"
众所周知,Angular 2最近获得了updated次版2.3。
现在我想知道如何相应地调整我的依赖项。例如,只更换与@angular / ...相关的所有2.2.0和2.3.0都不起作用。
那么如何确定哪些依赖关系可以更新到2.3以及哪些不是?
运行 npm outdated 后,我调整了我的package.json,如下所示:
"@angular/common": "~2.3.0",
"@angular/compiler": "~2.3.0",
"@angular/core": "~2.3.0",
"@angular/forms": "~2.3.0",
"@angular/http": "~2.3.0",
"@angular/platform-browser": "~2.3.0",
"@angular/platform-browser-dynamic": "~2.3.0",
"@angular/router": "~3.3.0",
"@angular/upgrade": "~2.3.0",
"angular-in-memory-web-api": "~0.2.0",
"bootstrap": "^3.3.7",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.1",
"systemjs": "0.19.41",
"zone.js": "^0.7.2",
"primeng": "^1.0.1",
"ng2-webstorage": "1.4.1"
但是,在 npm install 期间,我收到以下消息:
npm WARN peerDependencies codelyzer中包含的对等依赖项tslint@~4.0将为no npm WARN peerDependencies更长时间自动安装以实现peerDependency npm WARN peer npendencies in npm 3+。您的应用程序需要明确依赖它。 错误的ERR! Windows_NT 6.1.7601 错误的ERR! argv“C:\ Program Files \ nodejs \ node.exe”“C:\ Program Files \ nodejs \ node_modules \ npm \ bin \ npm-cli.js”“update” 错误的ERR!节点v4.4.7 错误的ERR! npm v2.15.8 错误的ERR!代码EPEERINVALID
npm ERR! peerinvalid包rxjs@5.0.1不满足其兄弟姐妹的peerDependencies要求! 错误的ERR! peerinvalid Peer @ angular / core @ 2.3.0想要rxjs@5.0.0-rc.4 错误的ERR! peerinvalid Peer @ angular / http @ 2.3.0想要rxjs@5.0.0-rc.4 错误的ERR! peerinvalid Peer @ angular / router @ 3.3.0想要rxjs@5.0.0-rc.4 错误的ERR! peerinvalid Peer angular-in-memory-web-api@0.2.0想要rxjs@5.0.0-rc.4 错误的ERR! peerinvalid Peer angular2-in-memory-web-api@0.0.20想要rxjs@5.0.0-beta.12
任何暗示这里有什么问题?
答案 0 :(得分:0)
你是什么意思,它不起作用?所有@angular
个包都应更新为2.3.0
和@router
至3.3.0
。发布新版本时,所有软件包都会更新。
另一方面,您还应该分别更新rxjs
和zone.js
个包裹,5.0.0-rc.4
和0.7.1
答案 1 :(得分:0)
如果你想更新更新angular2包,只需运行: npm update angular2 --save
另一种解决方案是安装此软件包: npm install -g npm-check-updates ,然后运行: ncu -u 重写您的package.json文件。