未满足的对等依赖关系

时间:2017-07-13 00:07:40

标签: angular npm

我想安装一个库来处理会话存储和本地存储。我尝试安装angular2-cool-storagengx-webstorage但我收到UNMET PEER DEPENDENCY错误。 当我运行npm install --save angular2-cool-storage这就是我在终端上获得的

CoreUI@1.0.0-alpha.4 d:\q2\Qabess-Web-App
+-- UNMET PEER DEPENDENCY @angular/common@2.4.8
+-- UNMET PEER DEPENDENCY @angular/core@2.4.8
`-- angular2-cool-storage@3.1.0
  `-- UNMET PEER DEPENDENCY zone.js@^0.8.4

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 
(node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for 
fsevents@1.1.2: wanted {"os":"darwin","arch":"any"} (current: 
{"os":"win32","arch":"x64"})
 npm WARN angular2-cool-storage@3.1.0 requires a peer of 
 @angular/core@^4.0.0 but none was installed.
 npm WARN angular2-cool-storage@3.1.0 requires a peer of 
 @angular/common@^4.0.0 but none was installed.
 npm WARN @angular/core@4.2.6 requires a peer of zone.js@^0.8.4 but none 
 was installed.

的package.json

{
"name": "CoreUI",
"version": "1.0.0-alpha.4",
"description": "Open Source Bootstrap Admin Template",
"author": "",
"url": "http://coreui.io",
"copyright": "Copyright 2017 creativeLabs Łukasz Holeczek",
"license": "MIT",
"angular-cli": {},
"scripts": {
"ng": "ng",
"start": "ng serve",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/common": "^2.4.8",
"@angular/compiler": "^2.4.8",
"@angular/core": "^2.4.8",
"@angular/forms": "^2.4.8",
"@angular/http": "2.4.8",
"@angular/platform-browser": "2.4.8",
"@angular/platform-browser-dynamic": "2.4.8",
"@angular/router": "3.4.8",
"@angular/upgrade": "2.4.8",
"angular-2-local-storage": "^1.0.1",
"angular2-cookie": "^1.2.6",
"angular2-cool-storage": "^3.1.0",
"chart.js": "2.5.0",
"core-js": "2.4.1",
"moment": "2.17.1",
"ng2-bootstrap": "1.3.3",
"ng2-charts": "1.5.0",
"ngx-webstorage": "^1.8.0",
"rxjs": "^5.2.0",
"sha256": "^0.2.0",
"ts-helpers": "1.1.2",
"zone.js": "0.7.7"
 },
 "devDependencies": {
 "@angular/cli": "1.0.0-rc.0",
 "@angular/compiler-cli": "2.4.8",
 "@types/jasmine": "2.5.43",
 "@types/node": "7.0.5",
 "codelyzer": "2.0.1",
 "jasmine-core": "2.5.2",
 "jasmine-spec-reporter": "3.2.0",
 "karma": "1.5.0",
 "karma-chrome-launcher": "2.0.0",
 "karma-cli": "1.0.1",
 "karma-jasmine": "1.1.0",
 "karma-jasmine-html-reporter": "0.2.2",
 "karma-coverage-istanbul-reporter": "0.2.3",
 "protractor": "5.1.1",
 "ts-node": "2.1.0",
 "tslint": "4.5.0",
 "typescript": "2.2.1" }

}

1 个答案:

答案 0 :(得分:0)

我认为您需要检查托管依赖项。您的依赖方法不匹配。您有library: "0.8.0"之类的内容,这意味着NPM将仅安装 该依赖项版本。你也有像library: "^0.8.0"这样的东西,这意味着完全不同的东西。如果您注意到其他输出警告,则说明

npm WARN @angular/core@4.2.6 requires a peer of zone.js@^0.8.4 but none was installed.

你从来没有说过你想要角度核心4.2.6,你说" ^ 2.4.8"但由于插入符号,NPM安装了最新的兼容主要版本的依赖项。

最后,请注意最后的警告。它表示您尝试添加的库取决于角度核心,其版本与4.0.0兼容。除非您正在处理遗留代码,否则我建议您将所有依赖项更新为更高版本。