每当我尝试运行 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 repo 下载 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/
关于git - 尝试创建 git clone 的前导目录时权限被拒绝,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49017385/