[X] 3.x
[X] bug report
Current behavior:
A dependency error is shown when trying to add a platform even though the current version matches the wanted version for ionic-angular. I am upgrading an existing app and believe I have the latest versions of everything.
Expected behavior:
Being able to add a platform.
ionic cordova platform add android
> cordova platform add android --save
Using cordova-fetch for cordova-android@^6.2.3
Error: Failed to fetch platform cordova-android@^6.2.3
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/bin/node" "/Users/michael/Developer/Ionic/Mobile/node_modules/.bin/npm" "install" "cordova-android@^6.2.3" "--production" "--save-exact"
npm ERR! node v9.0.0
npm ERR! npm v2.15.12
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package [email protected] does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @angular/[email protected] wants zone.js@^0.8.4
npm ERR! peerinvalid Peer [email protected] wants [email protected]
Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):
ionic info
cli packages: (/usr/local/lib/node_modules)
@ionic/cli-utils : 1.16.0
ionic (Ionic CLI) : 3.16.0
global packages:
cordova (Cordova CLI) : 7.1.0
local packages:
@ionic/app-scripts : 3.0.1
Cordova Platforms : ios
Ionic Framework : ionic-angular 3.8.0
System:
ios-deploy : 1.9.2
Node : v9.0.0
npm : 2.15.12
OS : macOS Sierra
Xcode : Xcode 9.1 Build version 9B55
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : legacy
After updating to the latest stable node and npm, removing node_modules and doing a npm install, I am still getting similar errors from @ionic-native/core:
ionic cordova platform add ios
> cordova platform add ios --save
Using cordova-fetch for cordova-ios@~4.5.1
Error: Failed to fetch platform cordova-ios@~4.5.1
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/bin/node" "/Users/michael/Developer/Ionic/Mobile/node_modules/.bin/npm" "install" "cordova-ios@~4.5.1" "--production" "--save-exact"
npm ERR! node v8.9.0
npm ERR! npm v2.15.12
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package @ionic-native/[email protected] does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/[email protected] wants @ionic-native/core@^3.6.0
It seems @ionic-native/[email protected] does not satisfy ^4.2.0 and ^3.6.0.
Comparing the ionic info output of a new project to my current project, it seems the System->npm version is stuck at 2.15.12. I've tried npm install npm@latest -g, deleting node_modules and doing npm install. When I npm -v into the console I get 5.5.1, indicating the latest is installed.
Finally I was able to get it working by forcing a version via npm install [email protected].
Do you have npm installed local to the project for some reason maybe? Sounds odd, but it is the only thing I can think of off the top of my head that would cause that. Somehow, you must have two versions of npm installed, and your project is picking up the older version.
Is your project out on GitHub? If so, I will take a look at it.
Actually, reading your last comment, I am somewhat confused. Is your project still stuck using npm 2.15.2 or do you have things working now?
Thanks @kensodemann - I was able to get it working by forcing the newer version in the project using npm install [email protected].
I'm still not sure why the project was using the older version despite the global version being the latest. I couldn't find anything in project settings that specify an npm version.
ahhhh, ok. This is starting to make sense now. This is just how npm works. If you looked at the package.json and didn't find a npm entry in either the dependencies or the devDependencies, but still had a local install of it, then you probably did a npm install npm (no -g or anything) at some point in the project's lifetime. That would have done a local install of npm (or whatever package was specified) without making an entry in the package.json file. My guess is that you did this at some point and should not have.
You should double check your package.json though, just to make sure it is not there. If it is there, remove it.
If you run npm ls npm in your project directory, and see something like the following, then you have a local copy.
~/Projects/Ionic/snapshot (feature/uploadScreenshot *): npm ls npm
[email protected] /Users/kensodemann/Projects/Ionic/snapshot
└── [email protected]
To remove it: npm remove npm
And then double check:
~/Projects/Ionic/snapshot (feature/uploadScreenshot *): npm ls npm
[email protected] /Users/kensodemann/Projects/Ionic/snapshot
└── (empty)
I am going to close this as it is not an issue with the Ionic Framework.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
Most helpful comment
Comparing the
ionic infooutput of a new project to my current project, it seems the System->npm version is stuck at2.15.12. I've triednpm install npm@latest -g, deleting node_modules and doingnpm install. When Inpm -vinto the console I get5.5.1, indicating the latest is installed.Finally I was able to get it working by forcing a version via
npm install [email protected].