Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Please try running this command again as Root/Administrator" error when trying to install LESS

I'm trying to install LESS on my machine and have installed node already. However, when I enter "node install -g less" I get the following error and am not sure what to do?

FPaulMAC:bin paul$ npm install -g less npm ERR! Error: EACCES, unlink '/usr/local/lib/node_modules/less' npm ERR!  { [Error: EACCES, unlink '/usr/local/lib/node_modules/less'] npm ERR!   errno: 3, npm ERR!   code: 'EACCES', npm ERR!   path: '/usr/local/lib/node_modules/less' } npm ERR!  npm ERR! Please try running this command again as root/Administrator.  npm ERR! System Darwin 13.3.0 npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "less" npm ERR! cwd /usr/local/bin npm ERR! node -v v0.10.33 npm ERR! npm -v 1.4.28 npm ERR! path /usr/local/lib/node_modules/less npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Error: EACCES, unlink '/usr/local/lib/node_modules/less' npm ERR! error rolling back Error: EACCES, unlink '/usr/local/lib/node_modules/less' npm ERR! error rolling back  { [Error: EACCES, unlink '/usr/local/lib/node_modules/less'] npm ERR! error rolling back   errno: 3, npm ERR! error rolling back   code: 'EACCES', npm ERR! error rolling back   path: '/usr/local/lib/node_modules/less' } npm ERR! not ok code 0 
like image 923
Stack Overflow Avatar asked Oct 28 '14 15:10

Stack Overflow


People also ask

How do I run command as root administrator on Mac?

To run commands with superuser privileges, use the sudo command. sudo stands for superuser do. You're asked for the password of the current user. You're asked to enter the password for adminUsername, after which a new shell is opened for that user.

Should I use sudo with NPM?

Any global installs will cache packages to /root/. npm instead of root -owned files at /home/me/. npm . Just always use sudo -i or sudo -H when running npm install to install global packages and your npm permissions problems will melt away.


1 Answers

Re Explosion Pills "An installation can run arbitrary scripts and running it with sudo can be extremely dangerous!"

Seems like using sudo is the wrong way of doing it.

"Change the owner of the files in your /usr/local folder to the current user:"

sudo chown -R $USER /usr/local 

Then run the install

node install -g less 

Check out:

  • npm throws error without sudo
  • https://aralbalkan.com/scribbles/npm-install-g-please-try-running-this-command-again-as-root-administrator/
  • http://foohack.com/2010/08/intro-to-npm/#what_no_sudo
like image 151
aturc Avatar answered Sep 29 '22 09:09

aturc