Issue adding plugin

Hey guys.

I’ve got an ionic native app. It’s close to finished, everything on the android side works perfect.

Eventually I got a Mac to build for iOS.

Now im trying to build the app, but im having trouble adding cordova-plugin-googlemaps.

Any help would be appreciated, i’ll paste my error output below.

Failed to install 'cordova-plugin-googlemaps': CordovaError: Failed to fetch plugin https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git#2.7.0 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 1
npm ERR! Command failed: /usr/bin/git clone --depth=1 -q -b 2.7.0 https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git /Users/simao/.npm/_cacache/tmp/git-clone-e3b0b2c7
npm ERR! /Users/simao/.npm/_cacache/tmp/git-clone-e3b0b2c7/.git: Permission denied
npm ERR! 

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/simao/.npm/_logs/2018-08-14T10_00_51_086Z-debug.log
    at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/plugman/fetch.js:173:37
    at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:864:24)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:890:30
    at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1142:31)
    at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:808:41)
    at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:624:44
    at runSingle (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:137:13)
    at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:125:13)
    at _combinedTickCallback (internal/process/next_tick.js:131:7)
    at process._tickCallback (internal/process/next_tick.js:180:9)

Your problem is probably with npm, something to do with permissions and files. This happens quite often and is almost impossible to successfully debug (at least here in the forum).

One solution: Uninstall your node, install nvm (or nvm-windows if you are on Windows), install a new node (which includes npm) with this, then install ionic and cordova again and try your command again. The problem should be gone.

Thanks for your reply Sujan.

I’ll try your suggestion and report back.

Thanks

Hey Sujan,

Suposedly I uninstalled node and all it’s dependencies.

Installed nvm, installed node through nvm, installed ionic and cordova.

Would you tell me to try and run the project, so it picks up the dependencies and installs them?

Or should I try to only install the plugin which throws the error?

Thanks

If you want to make sure: Remove the platforms, remove the plugins, re-add all of those.

Hey Sujan.

It didnt solve the problem.

But finally with the help of a colleague I managed to solve it.

In the end, the folders platforms and plugins, had permissions for root, while the others had permissions for my user. I changed the owner of the folders with chown and it worked.

Thanks again
Regards

1 Like