2

Hi i'm trying to install cordova with npm with

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

Operation not permitted

Is there a solution to this problem? Thanks in advance

JohnnyBeGoody
  • 253
  • 1
  • 3
  • 15

2 Answers2

6

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

RED.Skull
  • 1,696
  • 3
  • 24
  • 49
  • `sudo npm` is discouraged by the author of `npm`, see e.g. here for details: http://stackoverflow.com/a/29787931/1614973 – Dmitri Zaitsev May 16 '15 at 03:14
  • 1
    Also `npm install -g` is global install that **does not depend** on from where you execute it. – Dmitri Zaitsev May 16 '15 at 03:16
  • @DmitriZaitsev, be that as it may, the point is that RED.Skull is following the official installation instructions which calls for the use of `sudo`: https://cordova.apache.org/docs/en/4.0.0/guide_cli_index.md.html – Michael M Aug 31 '15 at 16:42
  • @Michael.M Then maybe informing the authors of that official instructions about the consequences of `sudo npm` would be of service to the community? – Dmitri Zaitsev Sep 01 '15 at 02:56
0

I tried installing using the command npm i -g cordova-res --unsafe-perm. It worked fine.

Vishrut Jha
  • 74
  • 1
  • 1
  • 9