Cordova-plugin-googlemaps: Error adding iOS platform with Cordova 7.0.0

Created on 5 May 2017  路  6Comments  路  Source: mapsplugin/cordova-plugin-googlemaps

Adding iOS platform to a simple (plain) Cordova v7.0.0 project with plugin cordova-plugin-googlemaps installed fails.

  • Android platform with Cordova 7.0.0 is OK
  • Other Cordova versions (i.e. 6.5.0) iOS and Android are OK
  • Cordova version 7.0.0 with iOS Platform FAILS

Steps to reproduce:

cordova create myApp org.apache.cordova.myApp myApp
cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="XXXX" --variable API_KEY_FOR_IOS="XXXX"
cordova platform add ios

Produces the following error:

Using cordova-fetch for cordova-ios@~4.4.0
Adding ios project...
Creating Cordova project for the iOS platform:
    Path: platforms/ios
    Package: org.apache.cordova.myApp
    Name: myApp
iOS project created with [email protected]
Installing "cordova-plugin-googlemaps" for ios
Failed to install 'cordova-plugin-googlemaps': Error
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:205:33
    at _rejected (/usr/local/lib/node_modules/cordova/node_modules/cordova-fetch/node_modules/q/q.js:864:24)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-fetch/node_modules/q/q.js:890:30
    at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/cordova-fetch/node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/cordova-fetch/node_modules/q/q.js:808:41)
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-fetch/node_modules/q/q.js:624:44
    at runSingle (/usr/local/lib/node_modules/cordova/node_modules/cordova-fetch/node_modules/q/q.js:137:13)
    at flush (/usr/local/lib/node_modules/cordova/node_modules/cordova-fetch/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)
Error: Failed to fetch plugin https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 235 Error output:
npm ERR! addLocal Could not install /var/folders/_0/mp2v3z7s3y37qhk8g763rb1m0000gn/T/npm-19771-8519b5c6/git-cache-ce3d7b54/4de7ae69fa092766d9f69095b3aad05859ac1d49
npm ERR! code EISDIR
npm ERR! errno -21
npm ERR! syscall read
npm ERR! eisdir EISDIR: illegal operation on a directory, read
npm ERR! eisdir This is most likely not a problem with npm itself
npm ERR! eisdir and is related to npm not being able to find a package.json in
npm ERR! eisdir a package you are trying to install.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/pjorquera/.npm/_logs/2017-05-05T18_20_07_726Z-debug.log

The error also occurs in version 2.0.0 beta (aka multiple_maps branch). If you try:

cordova create myApp org.apache.cordova.myApp myApp
cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_ANDROID="<YOUR KEY>" --variable API_KEY_FOR_IOS="<YOUR KEY>"
cordova platform add ios

Produces the same error.

Most helpful comment

Okay, I fixed the problem.
Please follow these command steps.

$> npm cache clean

$> cordova create myApp org.apache.cordova.myApp myApp

$> cd myApp

$> cordova platform add ios  //install the platform first for just in case

// If you get the below error, just ignore. And try again.
Error: Failed to fetch platform cordova-ios@~4.4.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Failed to get absolute path to installed module

$> cordova platform add ios

// Add the SDK plugin at first with --nofetch option
$> cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk --nofetch

$> cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_IOS="(API key)"

All 6 comments

Ah, I see.
As of Cordova 7.0, it requires a package.json file.
https://cordova.apache.org/news/2017/05/04/cordova-7.html

Okay, I fixed the problem.
Please follow these command steps.

$> npm cache clean

$> cordova create myApp org.apache.cordova.myApp myApp

$> cd myApp

$> cordova platform add ios  //install the platform first for just in case

// If you get the below error, just ignore. And try again.
Error: Failed to fetch platform cordova-ios@~4.4.0
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Failed to get absolute path to installed module

$> cordova platform add ios

// Add the SDK plugin at first with --nofetch option
$> cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk --nofetch

$> cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps#multiple_maps --variable API_KEY_FOR_IOS="(API key)"

Perfect @wf9a5m75! With these instructions everything is working OK in iOS!

The first cordova platform add ios was successfully (without any warnings) so I didn't need the "try again".

@wf9a5m75
thanks man

@wf9a5m75 sir i got below error after install
$> cordova plugin add https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk --nofetch

Error: Failed to fetch plugin https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk via registry.
Probably this is either a connection problem, or plugin spec is incorrect.
Check your connection and plugin name/version/URL.
Error: npm: Command failed with exit code 1 Error output:
npm ERR! code 128
npm ERR! Command failed: git clone --mirror -q https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git /var/root/.npm/_cacache/tmp/git-clone-e894a2c7/.git
npm ERR! fatal: could not create leading directories of '/var/root/.npm/_cacache/tmp/git-clone-e894a2c7/.git'
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR! /var/root/.npm/_logs/2019-03-29T10_46_55_700Z-debug.log

For me it's not even showing error. And no progress too. It just stopped.

Was this page helpful?
0 / 5 - 0 ratings