-1

i want to install a library to deal with session storage and local storage.I tried to install angular2-cool-storage and ngx-webstorage but i get UNMET PEER DEPENDENCY error. when i run npm install --save angular2-cool-storage that is what i get on the terminal

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" }

}

Marim
  • 11
  • 3
  • are you facing any issue ? i think Warning you can leave it. otherwise follow this guide https://stackoverflow.com/questions/35738346/how-to-solve-npm-unmet-peer-dependency?rq=1 – CharanRoot Jul 13 '17 at 00:19
  • Well it says 'UNMET PEER DEPENDENCY zone.js@^0.8.4', if you look at your package.json, you have defined you are only using 0.7.7 – SaxyPandaBear Jul 13 '17 at 00:20

1 Answers1

0

I think you need to check over your managed dependencies. You have a mismatch of dependency approaches. You have things like library: "0.8.0" which means that NPM will install only that version of the dependency. You also have things like library: "^0.8.0" which means something entirely different. If you notice your other output warnings, it says

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

You never said you wanted 4.2.6 for angular core, you said "^2.4.8" but because of the caret, NPM installed the latest compatible major version of the dependency.

Finally, note the warnings at the end. It says that the library you are trying to add depends on angular core with a version compatible with 4.0.0. Unless you're dealing with legacy code, I'd suggest updating all of the dependencies to later versions.

SaxyPandaBear
  • 377
  • 1
  • 6