每当我尝试在应用程序上运行npm install
时,我会收到以下错误:
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
这是我检查.npm
文件夹的许可时得到的:
drwxrwxrwx 6 root staff 192 Feb 27 22:11 .npm
我的环境:
- GIT版本2.14.3(Apple Git-98(
- 节点v9.4.0
- NPM v5.4.0
在这种情况下,我建议您从git reto下载master.zip文件,然后安装。
$> 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="..."
(更新(
问题可能是git命令版本过时。为了升级GIT命令,您可以选择:
(option 1)
$> brew upgrade git
(option 2)
Install the latest git command from here
https://git-scm.com/
我在Jenkins服务器上安装的卷上运行npm install
时遇到了该错误。
在我的情况下,问题是由此错误引起的:由于v6.11.0,无法从Docker中的Git安装NPM软件包这里也提到了:安装目录(节点:12-SLIM(
时,无法从GitHub安装软件包该错误已修复在 NPM版本V6.13.6
中我使用了节点12.13.0并升级到版本> 14(包含NPM版本v6.13.6(解决了我的问题。
也许需要根权利。
sudo npm install