question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Unable to install iOS platform

See original GitHub issue

Bug Report

Problem

When I go to add iOS platform to a newly-created Cordova project I get an error.

What is expected to happen?

Cordova should add iOS platform

What does actually happen?

Command fails with a NPM error

Information

Transcript of the shell session:

cordova platform add ios
Using cordova-fetch for cordova-ios@^5.0.0
Failed to fetch platform cordova-ios@^5.0.0
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! Unexpected end of JSON input while parsing near '...p":"^0.0.26"},"_hasSh'

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/redacted/.npm/_logs/2019-04-29T19_28_11_053Z-debug.log

Debug log contents:

0 info it worked if it ends with ok
1 verbose cli [ '/opt/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   'cordova-ios@^5.0.0',
1 verbose cli   '--production',
1 verbose cli   '--save' ]
2 info using npm@6.8.0
3 info using node@v10.15.3
4 verbose npm-session f751d091bf0a3560
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 http fetch GET 304 https://registry.npmjs.org/cordova-ios 108ms (from cache)
8 silly fetchPackageMetaData error for cordova-ios@^5.0.0 Unexpected end of JSON input while parsing near '...p":"^0.0.26"},"_hasSh'
9 timing stage:rollbackFailedOptional Completed in 0ms
10 timing stage:runTopLevelLifecycles Completed in 143ms
11 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...p":"^0.0.26"},"_hasSh'
11 verbose stack     at JSON.parse (<anonymous>)
11 verbose stack     at parseJson (/usr/local/lib/node_modules/npm/node_modules/json-parse-better-errors/index.js:7:17)
11 verbose stack     at consumeBody.call.then.buffer (/usr/local/lib/node_modules/npm/node_modules/node-fetch-npm/src/body.js:96:50)
11 verbose stack     at process._tickCallback (internal/process/next_tick.js:68:7)
12 verbose cwd /Users/redacted/CdvTest
13 verbose Darwin 18.5.0
14 verbose argv "/opt/local/bin/node" "/usr/local/bin/npm" "install" "cordova-ios@^5.0.0" "--production" "--save"
15 verbose node v10.15.3
16 verbose npm  v6.8.0
17 error Unexpected end of JSON input while parsing near '...p":"^0.0.26"},"_hasSh'
18 verbose exit [ 1, true ]

Command or Code

cordova platform add ios

(Android platform adds fine)

Environment, Platform, Device

  • MacOS Mojave 10.14.4

Version information

  • Cordova CLI version 9.0.0 (cordova-lib@9.0.1)
  • NPM version 6.8.0
  • Node version v10.15.3

Checklist

  • I searched for existing GitHub issues
  • I updated all Cordova tooling to most recent version
  • I included all the necessary information above

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
jakubdolejscommented, Apr 29, 2019

Thank you @janpio. You’re right. Something with the cache. I set the NPM cache using npm install --cache /tmp/npm-cache and I was able to install the platform.

0reactions
kuttikrishnankodothcommented, Apr 14, 2020

Iam new to Ios and app development, I had the similar issue and npm install --cache /tmp/npm-cache fixed it. but iam not sure what it does though 😃 @jakubdolejs

Read more comments on GitHub >

github_iconTop Results From Across the Web

iOS14.0 Unable to install app | Apple Developer Forums
Hi folks, I have an enterprise app which can be downloaded from safari. When I download the app from iOS 14.0 device it...
Read more >
Unable to install iOS App - ManageEngine
App cannot be downloaded on the device · On the managed devices, go to Settings and click on iTunes & App Store ·...
Read more >
Unable to install iOS 16.2 Update on iPhone? 6 Tips to Fix it
New iOS install installation required free Gigabytes of Storage on iOS device, Sometimes small software updates in a whole year required Small space...
Read more >
iOS 16 Not Installing, How to Fix? (Works on 16.1, 16.2)
There may be a temporary bug on your phone causing the update to fail every time you try to install. A simple restart...
Read more >
Guide to Fix the "unable to install .ipa file" Issue on iOS Devices
The app to be installed does not support the required device capabilities and OS architecture. This usually happens if you are trying to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found