【发布时间】:2017-12-04 03:44:12
【问题描述】:
我的package.json 看起来像这样
{
"name": "hello-world",
"version": "1.0.0",
"description": "The Hello World",
"author": "",
"license": "MIT",
"scripts": {
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"dependencies": {
"@angular/common": "~2.0.1",
"@angular/compiler": "~2.0.1",
"@angular/core": "~2.0.1",
"@angular/http": "~2.0.1",
"@angular/platform-browser": "~2.0.1",
"@angular/platform-browser-dynamic": "~2.0.1",
"@angular/router": "~3.0.1",
"@angular/upgrade": "~2.0.1",
"systemjs": "0.19.39",
"core-js": "^2.4.1",
"reflect-metadata": "^0.1.8",
"rxjs": "5.0.0-beta.12",
"zone.js": "^0.6.25",
"angular-in-memory-web-api": "~0.1.1",
"bootstrap": "4.0.0-alpha.4"
},
"devDependencies": {
"concurrently": "^3.0.0",
"lite-server": "^2.2.2",
"typescript": "^2.0.3",
"typings": "^1.4.0"
}
}
当我运行 npm i 时,它运行成功,但我收到了一些警告。
npm WARN angular-in-memory-web-api@0.1.17 requires a peer of rxjs@5.0.0-rc.4 but none was installed.
npm WARN angular-in-memory-web-api@0.1.17 requires a peer of zone.js@^0.7.2 but none was installed.
我将这些行添加到package.json
"peerDependencies": {
"rxjs": "5.0.0-rc.4",
"zone.js": "^0.7.2"
}
但是当我再次运行 npm i 时,我仍然收到此警告
npm WARN hello-world@1.0.0 requires a peer of rxjs@5.0.0-rc.4 but none was installed.
npm WARN hello-world@1.0.0 requires a peer of zone.js@^0.7.2 but none was installed.
npm WARN angular-in-memory-web-api@0.1.17 requires a peer of rxjs@5.0.0-rc.4 but none was installed.
npm WARN angular-in-memory-web-api@0.1.17 requires a peer of zone.js@^0.7.2 but none was installed.
对主应用程序附加警告。
为什么会这样以及如何消除此警告?
【问题讨论】:
-
简而言之:您只需将它们作为正常依赖项添加到项目中即可。
-
你的意思是把它们添加到
dependencies对应的版本?切换到zone.js^0.7.2导致ERR和unmet peer dependency zone.js@0.7.8 -
请求的对等体是 0.7.8 版本,而不是 ^0.7.2。
-
在我的帖子中,他们需要
^0.7.2- 需要 zone.js@^0.7.2 的对等但没有安装 - 但是当我添加它时,它开始需要0.7.8
标签: npm package.json