cordova-cli: Failed to fetch platform

Cordova version: 7.0.1 and 7.1.0 Last time build app was on 09.10.18. But now when running npx cordova platform add ios@4.5.4, I’m getting following error:

Error: Failed to fetch platform cordova-ios@4.5.4
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 WARN package.json NAME.app@1.0.0 No repository   ##field.
npm WARN package.json NAME.app@1.0.0 No README data
npm ERR! Darwin 18.0.0
npm ERR! argv "/usr/local/bin/node" "/PATH/node_modules/.bin/npm" "install" "cordova-ios@4.5.4" "--save"
npm ERR! node v8.12.0
npm ERR! npm  v2.15.12
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package acorn@5.7.3 does not satisfy its siblings' peerDependencies requirements!

Found that ticket of acorn package.

Any work around?

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 22 (9 by maintainers)

Commits related to this issue

Most upvoted comments

@genox I’ve unpinned the cordova version in dependencies of cordova-check-plugins (my package, my bad) and published a patch version to npm as cordova-check-plugins@4.0.4 - should resolve your issue, though global installation is recommended as it’s a CLI tool (as is cordova)

workaround: run npm install acorn in the Cordova project directory. that should install acorn@6 and that fixes the error for me (using cordova@8.1.2)

My team project appears to have acquired a direct dependency on cordova-lib@7.1.0 - removing it resolves the issue.

├─┬ cordova-lib@7.1.0

npm ls npm output:

└─┬ cordova-check-plugins@4.0.3
  ├─┬ cordova@7.1.0
  │ └─┬ cordova-lib@7.1.0
  │   └── npm@2.15.12
  └─┬ plugman@1.3.0
    └─┬ cordova-lib@6.2.0
      └── npm@2.15.12  deduped

I removed cordova-check-plugins from the project and after another reset, things seem to install fine now. Thanks for your help!