Unable to install the Google Maps plugin

When I execute the following command to install and use Google Maps, as explained on: http://ionicframework.com/docs/native/google-maps/

ionic cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID=“KEY” --variable API_KEY_FOR_IOS=“KEY”

I get the following error message:

(truncated) …
uter\AppData\Local\Temp\npm-1572-09cb6f0f\git-cache-15613c6b\a2809eab22af60a0b05e745008d195ee89b1bd01:
npm ERR! Windows_NT 10.0.10586
npm ERR! argv “C:\Program Files\nodejs\node.exe” “C:\Program
Files\nodejs\node_modules\npm\bin\npm-cli.js” “install”
https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk” "–save"
npm ERR! node v6.11.0
npm ERR! npm v3.10.10
npm ERR! code 128

    npm ERR! Command failed: git -c core.longpaths=true clone
    C:\Users\wouter\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-mapsplugin-cordova-plugin-googlemaps-sdk-git-324aac43
    C:\Users\wouter\AppData\Local\Temp\npm-1572-09cb6f0f\git-cache-15613c6b\a2809eab22af60a0b05e745008d195ee89b1bd01
    npm ERR! Cloning into
    'C:\Users\wouter\AppData\Local\Temp\npm-1572-09cb6f0f\git-cache-15613c6b\a2809eab22af60a0b05e745008d195ee89b1bd01'...
    npm ERR! error: cannot spawn sh: No such file or directory
    npm ERR! fatal: unable to fork
    npm ERR!
    npm ERR!
    npm ERR! If you need help, you may report this error at:
    npm ERR!     <https://github.com/npm/npm/issues>

    npm ERR! Please include the following file with any support request:
    npm ERR!     C:\Users\wouter\Code\ionic3 Firebase\node_modules\npm-debug.log
    at C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\fetch.js:205:33
    at _rejected
    (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:864:24)
    at
    C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:890:30
    at Promise.when
    (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:1142:31)
    at Promise.promise.promiseDispatch
    (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:808:41)
    at
    C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:624:44
    at runSingle
    (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:137:13)
    at flush
    (C:\Users\wouter\AppData\Roaming\npm\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: cmd: Command failed with exit code 1 Error output:
    npm ERR! git clone

Does anybody have an idea what im doing wrong?

Please edit your post and use the </> button above the post input field to format your code or error message or wrap it in ``` (“code fences”) manually. This will make sure your text is readable and if it recognizes the programming language it also automatically adds code syntax highlighting. Thanks.

Run cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="KEY" --variable API_KEY_FOR_IOS="KEY" --debug please and post the output.
What is your ionic info output?

Thank you for the reply, the output is:

✖ Running command - failed!

[ERROR] Cordova encountered an error.
        You may get more insight by running the Cordova command above directly.

[ERROR] An error occurred while running cordova plugin add cordova-plugin-googlemaps --variable
        API_KEY_FOR_ANDROID=AIza... (exit code 1):

        (truncated) ...
        uter\AppData\Local\Temp\npm-7288-2587745f\git-cache-e9129031\a2809eab22af60a0b05e745008d195ee89b1bd01:
        npm ERR! Windows_NT 10.0.10586
        npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
        Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
        "https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk" "--save"
        npm ERR! node v6.11.0
        npm ERR! npm  v3.10.10
        npm ERR! code 128

        npm ERR! Command failed: git -c core.longpaths=true clone
        C:\Users\wouter\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-mapsplugin-cordova-plugin-googlemaps-sdk-git-324aac43
        C:\Users\wouter\AppData\Local\Temp\npm-7288-2587745f\git-cache-e9129031\a2809eab22af60a0b05e745008d195ee89b1bd01
        npm ERR! Cloning into
        'C:\Users\wouter\AppData\Local\Temp\npm-7288-2587745f\git-cache-e9129031\a2809eab22af60a0b05e745008d195ee89b1bd01'...
        npm ERR! error: cannot spawn sh: No such file or directory
        npm ERR! fatal: unable to fork
        npm ERR!
        npm ERR!
        npm ERR! If you need help, you may report this error at:
        npm ERR!     <https://github.com/npm/npm/issues>

        npm ERR! Please include the following file with any support request:
        npm ERR!     C:\Users\wouter\Code\ionic3 Firebase\node_modules\npm-debug.log
        at C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\fetch.js:205:33
        at _rejected
        (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:864:24)
        at
        C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:890:30
        at Promise.when
        (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:1142:31)
        at Promise.promise.promiseDispatch
        (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:808:41)
        at
        C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:624:44
        at runSingle
        (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-fetch\node_modules\q\q.js:137:13)
        at flush
        (C:\Users\wouter\AppData\Roaming\npm\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: cmd: Command failed with exit code 1 Error output:
        npm ERR! git clone
        C:\Users\wouter\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-mapsplugin-cordova-plugin-googlemaps-sdk-git-324aac43
        C:\Users\wouter\AppData\Local\Temp\npm-7288-2587745f\git-cache-e9129031\a2809eab22af60a0b05e745008d195ee89b1bd01:
        Cloning into
        'C:\Users\wouter\AppData\Local\Temp\npm-7288-2587745f\git-cache-e9129031\a2809eab22af60a0b05e745008d195ee89b1bd01'...
        npm ERR! git clone
        C:\Users\wouter\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-mapsplugin-cordova-plugin-googlemaps-sdk-git-324aac43
        C:\Users\wouter\AppData\Local\Temp\npm-7288-2587745f\git-cache-e9129031\a2809eab22af60a0b05e745008d195ee89b1bd01:
        error: cannot spawn sh: No such file or directory
        npm ERR! git clone
        C:\Users\wouter\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-mapsplugin-cordova-plugin-googlemaps-sdk-git-324aac43
        C:\Users\wouter\AppData\Local\Temp\npm-7288-2587745f\git-cache-e9129031\a2809eab22af60a0b05e745008d195ee89b1bd01:
        fatal: unable to fork
        npm ERR! git clone
        C:\Users\wouter\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-mapsplugin-cordova-plugin-googlemaps-sdk-git-324aac43
        C:\Users\wouter\AppData\Local\Temp\npm-7288-2587745f\git-cache-e9129031\a2809eab22af60a0b05e745008d195ee89b1bd01:

        npm ERR! Windows_NT 10.0.10586
        npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program
        Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
        "https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk" "--save"
        npm ERR! node v6.11.0
        npm ERR! npm  v3.10.10
        npm ERR! code 128

        npm ERR! Command failed: git -c core.longpaths=true clone
        C:\Users\wouter\AppData\Roaming\npm-cache\_git-remotes\git-https-github-com-mapsplugin-cordova-plugin-googlemaps-sdk-git-324aac43
        C:\Users\wouter\AppData\Local\Temp\npm-7288-2587745f\git-cache-e9129031\a2809eab22af60a0b05e745008d195ee89b1bd01
        npm ERR! Cloning into
        'C:\Users\wouter\AppData\Local\Temp\npm-7288-2587745f\git-cache-e9129031\a2809eab22af60a0b05e745008d195ee89b1bd01'...
        npm ERR! error: cannot spawn sh: No such file or directory
        npm ERR! fatal: unable to fork
        npm ERR!
        npm ERR!
        npm ERR! If you need help, you may report this error at:
        npm ERR!     <https://github.com/npm/npm/issues>

        npm ERR! Please include the following file with any support request:
        npm ERR!     C:\Users\wouter\Code\ionic3 Firebase\node_modules\npm-debug.log

The output of ionic info is:


global packages:

    @ionic/cli-utils : 1.4.0
    Cordova CLI      : 7.0.1
    Ionic CLI        : 3.4.0

local packages:

    @ionic/app-scripts              : 1.3.7
    @ionic/cli-plugin-cordova       : 1.4.0
    @ionic/cli-plugin-ionic-angular : 1.3.1
    Cordova Platforms               : android 6.2.3 ios 4.4.0
    Ionic Framework                 : ionic-angular 3.4.2

System:

    Node       : v6.11.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 3.10.10

That is the output of the same command as you posted above. Please run the new command I posted.

The --debug doesn’t appear to be doing anything. I’ve tried adding it to the beginning of the command as well.

You should execute the cordova command directly, withouth the ionic in front.

Thank you, i missed that difference, i also added --force, but am getting the following output now (despite the --force), the full comman i ran was:

cordova plugin add cordova-plugin-googlemaps --force --debug --variable API_KEY_FOR_ANDROID=“KEY” --variable API_KEY_FOR_IOS=“KEY”

I also tried it after removing it first with

cordova plugin remove cordova-plugin-googlemaps

Same results (see below):

Plugin "cordova-plugin-googlemaps" already installed on android.
Installing "cordova-plugin-googlemaps" for ios
Plugin dependency "com.googlemaps.ios@2.2.0-fixed" already fetched, using that version.
Installing "com.googlemaps.ios" for ios
Error during processing of action! Attempting to revert...
Failed to install 'com.googlemaps.ios': CordovaError: Uh oh!
File already exists at destination "C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\newsApp\Resources\GoogleMaps.bundle" for resource file specified by plugin com.googlemaps.ios in iOS platform
    at install (C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\cordova\lib\plugman\pluginHandlers.js:64:23)
    at Object.process (C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\cordova\node_modules\cordova-common\src\ActionStack.js:56:25)
    at PluginManager.doOperation (C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\cordova\node_modules\cordova-common\src\PluginManager.js:117:20)
    at PluginManager.addPlugin (C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\cordova\node_modules\cordova-common\src\PluginManager.js:147:17)
    at Api.addPlugin (C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\cordova\Api.js:235:10)
    at handleInstall (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:619:6)
    at C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:379:28
    at _fulfilled (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:816:30)
    at Promise.promise.promiseDispatch (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:749:13)
Failed to install 'cordova-plugin-googlemaps': CordovaError: Uh oh!
File already exists at destination "C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\newsApp\Resources\GoogleMaps.bundle" for resource file specified by plugin com.googlemaps.ios in iOS platform
    at install (C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\cordova\lib\plugman\pluginHandlers.js:64:23)
    at Object.process (C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\cordova\node_modules\cordova-common\src\ActionStack.js:56:25)
    at PluginManager.doOperation (C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\cordova\node_modules\cordova-common\src\PluginManager.js:117:20)
    at PluginManager.addPlugin (C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\cordova\node_modules\cordova-common\src\PluginManager.js:147:17)
    at Api.addPlugin (C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\cordova\Api.js:235:10)
    at handleInstall (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:619:6)
    at C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\cordova-lib\src\plugman\install.js:379:28
    at _fulfilled (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:787:54)
    at self.promiseDispatch.done (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:816:30)
    at Promise.promise.promiseDispatch (C:\Users\wouter\AppData\Roaming\npm\node_modules\cordova\node_modules\q\q.js:749:13)
Error: Uh oh!
File already exists at destination "C:\Users\wouter\Code\ionic3 Firebase\platforms\ios\newsApp\Resources\GoogleMaps.bundle" for resource file specified by plugin com.googlemaps.ios in iOS platform

Ok, now something is messed up. Run the “remove” command again, then remove and re-add the platform and check manually that the plugin is not present. Also check config.xml and package.json that the plugin is not present there. Otherwise you won’t be able to solve that.