lgh lgh - 2 months ago 38
Node.js Question

NPM wants multiple versions of the same package and gives peer invalid errors

I am currently using Ionic 2 bet 6 and slowly working my way through upgrading to the newest version. As I am doing this, I am running into several package issues where NPM wants different versions of the same package. These versions frequently look like they are the same version of the same package just with slightly different naming conventions.

Here's what I have right now:

npm ERR! peerinvalid The package @angular/common@2.0.0-rc.1 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/platform-browser@2.0.0 wants @angular/common@^2.0.0
npm ERR! peerinvalid Peer @angular/platform-browser-dynamic@2.0.0 wants @angular/common@^2.0.0
npm ERR! peerinvalid Peer @angular/router@2.0.0-rc.2 wants @angular/common@^2.0.0-rc
npm ERR! peerinvalid Peer ionic-angular@2.0.0-beta.7 wants @angular/common@^2.0.0-rc.1


I am using NPM v2.15.9.

My package.json:

{
"dependencies": {
"@angular/common": "2.0.0-rc.1",
"@angular/compiler": "^2.0.0-rc.1",
"@angular/core": "^2.0.0-rc.1",
"@angular/http": "^2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"@angular/router": "^2.0.0-rc.1",
"es6-shim": "^0.35.0",
"ionic-angular": "2.0.0-beta.7",
"ionic-native": "^1.1.0",
"ionicons": "3.0.0",
"jquery": "^2.2.3",
"lodash": "^4.12.0",
"moment": "^2.13.0",
"reflect-metadata": "^0.1.3",
"rxjs": "^5.0.0-beta.6",
"typescript": "^1.8.10",
"zone.js": "^0.6.21"
},
"devDependencies": {
"del": "2.2.0",
"gulp": "3.9.1",
"gulp-watch": "4.3.5",
"ionic-gulp-browserify-typescript": "^1.1.0",
"ionic-gulp-fonts-copy": "^1.0.0",
"ionic-gulp-html-copy": "^1.0.0",
"ionic-gulp-sass-build": "^1.0.0",
"ionic-gulp-scripts-copy": "^2.0.0",
"run-sequence": "1.1.5"
},
"cordovaPlugins": [
"cordova-plugin-device",
"cordova-plugin-console",
"cordova-plugin-whitelist",
"cordova-plugin-splashscreen",
"cordova-plugin-statusbar",
"cordova-plugin-inappbrowser",
"ionic-plugin-keyboard"
],
"cordovaPlatforms": [
"ios",
{
"platform": "ios",
"version": "",
"locator": "ios"
}
],
"name": "REDACTED",
"description": "REDACTED"
}


I have this based off the the package.json that ionic recommends working off of for beta 7 in the changelog from beta 6.

Answer

Looks like you are still using angular2 RC1.

Update angular packages like this. Remove ^ from angular packages.

"@angular/common":  "2.0.0-rc.1",
"@angular/compiler":  "2.0.0-rc.1",
"@angular/core":  "2.0.0-rc.1",
"@angular/http":  "2.0.0-rc.1",
"@angular/platform-browser":  "2.0.0-rc.1",
"@angular/platform-browser-dynamic":  "2.0.0-rc.1",
"@angular/router":  "2.0.0-rc.1",
"@angular/router-deprecated":  "2.0.0-rc.1",
"@angular/upgrade":  "2.0.0-rc.1",
Comments