我正在使用Mac OS Sierra v10.12并在myApp文件夹中添加我的Phonegap项目时收到错误:
$ node -v
v7.2.0
$ npm -v
3.10.9
$ cordova platform add ios
收到以下错误:
Error during untar for /Users/{user_name}/.cordova/lib/npm_cache/cordova-ios/4.3.0/package.tgz: Error: EACCES: permission denied, open '/Users/{user_name}/.cordova/lib/npm_cache/cordova-ios/4.3.0/package/package.json'
Error: Failed to fetch platform ios
Probably this is either a connection problem, or platform spec is incorrect.
Check your connection and platform name/version/URL.
Error: EACCES: permission denied, open '/Users/{user_name}/.cordova/lib/npm_cache/cordova-ios/4.3.0/package/package.json'
注意:{user_name}是我的mac用户ID,任何人都可以帮助我!
答案 0 :(得分:4)
我认为您必须发布添加平台的权限。
尝试以下内容:
$sudo chown -R {user_name} /Users/{user_name}/.cordova/lib/npm_cache/
有关详情,请查看here。
希望这会对你有帮助!
答案 1 :(得分:2)
也许这是cordova的缓存问题。删除缓存并尝试再次添加平台:
rm -rf ~/.cordova