0

I've got this problem:

allart@allart-vm-lubuntu:~/Documents/apps/MyApp/myapp$ 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! Linux 4.13.0-16-generic
npm ERR! argv "/usr/local/bin/node" "/home/allart/Documenti/apps/MyApp/myapp/node_modules/.bin/npm" "install" "cordova-android@^6.2.3" "--production" "--save-exact"
npm ERR! node v9.2.0
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package @ionic-native/core@4.4.2 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer @ionic-native/camera@4.4.2 wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/facebook@4.4.2 wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/file@4.4.2 wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/file-path@4.4.2 wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/in-app-browser@4.4.2 wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/splash-screen@3.12.1 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/sqlite@4.4.2 wants @ionic-native/core@^4.2.0
npm ERR! peerinvalid Peer @ionic-native/status-bar@3.12.1 wants @ionic-native/core@^3.6.0
npm ERR! peerinvalid Peer @ionic-native/transfer@3.14.0 wants @ionic-native/core@^3.6.0

npm ERR! Please include the following file with any support request:
npm ERR!     /home/allart/Documenti/apps/MyApp/myapp/npm-debug.log

[ERROR] Exception: 

Already tried with npm cache clean, uninstalling and reinstalling packages and managers, rebooting, upgrading system and so on.

Here are my specs:

$ node -v
v9.2.0

$ npm -v
3.10.10

$ ionic -v
3.18.0

$ cordova -v
7.1.0

Ubuntu 17.10 on a VM. 

Any ideas? Thank you in advance.

Yuri Refolo
  • 245
  • 9
  • 17
  • I think it's the same issue here and was resolved https://stackoverflow.com/a/45174553/3075243 – Proustibat Nov 21 '17 at 22:29
  • Already tried, with no luck :( – Yuri Refolo Nov 21 '17 at 23:35
  • Did you also tried with the flag `--nofetch`? – Proustibat Nov 21 '17 at 23:47
  • Didn't work, sorry. I "solved" recreating a new project, downgrading to old node version (v6.12.0) and old npm version (3.0.0), importing every module by hand one by one and trying to recreate the original code. I somehow managed it to work, then I merged locally with the original folder and pushed to repo. It is'nt a real solution, anyhow but only a workaround, so I can't mark it as solved. – Yuri Refolo Nov 23 '17 at 08:26

2 Answers2

0

Check if you have node_modules folder in your home directory, and if so remove it, see https://github.com/nodejs/node/issues/9377#issuecomment-330234631. This fixed it for me on MacOS.

Doing the following also worked for me, but had to do it each time

 rm -r node_modules/
0

There is no need for removing the whole node_modules folder.

Just remove the following folder within the node_modules folder:

  • rm -R node_modules/cordova-android
  • rm -R node_modules/ionic-angular

and remove the package-lock.json:

  • rm package-lock.json
SimoneMSR
  • 368
  • 1
  • 6
  • 16