简体   繁体   English

无法在Mac OS X上使用NPM安装Cordova

[英]Fail to install cordova with npm on Mac os x

Hi i'm trying to install cordova with npm with 嗨,我正在尝试使用npm安装cordova

sudo npm install -g cordova

And i have this error 我有这个错误

npm ERR! Error: EACCES, symlink '../lib/node_modules/cordova/bin/cordova'
npm ERR!  { [Error: EACCES, symlink '../lib/node_modules/cordova/bin/cordova']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '../lib/node_modules/cordova/bin/cordova' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "cordova"
npm ERR! cwd /Users/yannickghilardi
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11
npm ERR! path ../lib/node_modules/cordova/bin/cordova
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, symlink '../lib/node_modules/cordova/bin/cordova'
npm ERR! Error: EACCES, open 'npm-debug.log'
npm ERR!  { [Error: EACCES, open 'npm-debug.log'] errno: 3, code: 'EACCES', path:  'npm-debug.log' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Darwin 11.4.2
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "cordova"
npm ERR! cwd /Users/yannickghilardi
npm ERR! node -v v0.10.21
npm ERR! npm -v 1.3.11
npm ERR! path npm-debug.log
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open 'npm-debug.log'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/yannickghilardi/npm-debug.log
npm ERR! not ok code 0

Then i tried to use this command sudo chown -R yannickghilardi /usr/local/lib/node_modules And i have this error message 然后我尝试使用此命令sudo chown -R yannickghilardi / usr / local / lib / node_modules而且我收到此错误消息

Operation not permitted

Is there a solution to this problem? 有解决这个问题的方法吗? Thanks in advance 提前致谢

Just now i solved this issue. 刚才我解决了这个问题。 Execute this command by going into to the root folder. 通过进入根文件夹来执行此命令。

Destination folder -- > /usr/local/lib/node_modules/ and type the command sudo npm install -g cordova 目标文件夹-> / usr / local / lib / node_modules /并键入命令sudo npm install -g cordova

I tried installing using the command npm i -g cordova-res --unsafe-perm . 我尝试使用命令npm i -g cordova-res --unsafe-perm It worked fine. 工作正常。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM