我正在尝试使用npm install -g cordova
在我的ubuntu(15.10)中安装cordova,但收到以下错误
npm WARN locking Error: EACCES, open '/home/gopi/.npm/_locks/cordova-fa12e2e096426a32.lock'
npm WARN locking at Error (native)
npm WARN locking /home/gopi/.npm/_locks/cordova-fa12e2e096426a32.lock failed { [Error: EACCES, open '/home/gopi/.npm/_locks/cordova-fa12e2e096426a32.lock']
npm WARN locking errno: -13,
npm WARN locking code: 'EACCES',
npm WARN locking path: '/home/gopi/.npm/_locks/cordova-fa12e2e096426a32.lock' }
npm ERR! Linux 4.2.0-30-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "cordova"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! Attempt to unlock /usr/local/lib/node_modules/cordova, which hasn't been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/gopi/npm-debug.log
当我尝试给ionic build android
时,我收到此错误,当我尝试cordova -v
检查当前版本时,我得到相同的错误。
/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES, permission denied '/home/gopi/.config/configstore/update-notifier-cordova.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:500:18)
at Object.fs.readFileSync (fs.js:352:15)
at Object.create.all.get (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:27:44)
at new UpdateNotifier (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:34:17)
at module.exports (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:123:23)
at checkForUpdates (/usr/local/lib/node_modules/cordova/src/cli.js:64:20)
at cli (/usr/local/lib/node_modules/cordova/src/cli.js:116:5)
at Object.<anonymous> (/usr/local/lib/node_modules/cordova/bin/cordova:41:1)
是否有任何人知道为什么权限被拒绝,我也尝试过sudo npm install -g cordova
,但结果仍然相同。
答案 0 :(得分:0)
这似乎是一个权限问题,请尝试:
sudo chown -R $(whoami) "$HOME/.npm"