Whenever I try to run npm install
on my app, I get the following error:
Eliyas-MacBook-Pro:app-name root# npm install
npm ERR! code 128
npm ERR! Command failed: /usr/bin/git clone -q https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk.git /var/root/.npm/_cacache/tmp/git-clone-31357d5e
npm ERR! fatal: could not create leading directories of '/var/root/.npm/_cacache/tmp/git-clone-31357d5e': Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /var/root/.npm/_logs/2018-02-27T20_18_34_759Z-debug.log
This is what I get when I check the permission of the .npm
folder:
drwxrwxrwx 6 root staff 192 Feb 27 22:11 .npm
My environment:
In that case I recommend you download the master.zip file from the git repo, then install it.
$> wget https://github.com/mapsplugin/cordova-plugin-googlemaps-sdk/archive/master.zip
$> unzip master.zip
$> mv master cordova-plugin-googlemaps-sdk
$> cd (your project dir)
$> cordova plugin add (path to)/cordova-plugin-googlemaps-sdk
$> cordova plugin add cordova-plugin-googlemaps --variable API_KEY_FOR_ANDROID="..." --variable API_KEY_FOR_IOS="..."
(update)
The problem might be the git command version is out-of-dated. In order to upgrade the git command, you may choose :
(option 1)
$> brew upgrade git
(option 2)
Install the latest git command from here
https://git-scm.com/
I got that error when running npm install
on a mounted volume on a Jenkins server.
In my case the issue was caused by this bug: Failed to install npm package from git in docker since v6.11.0 Which is also mentioned here: Cannot install packages from GitHub when mounting directory (node:12-slim)
The bug is fixed in npm version v6.13.6
I used node 12.13.0 and upgrading to version >14 (which contains npm version v6.13.6) fixed my problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With