Please Try Running This Command Again as Root/administrator.
I'chiliad trying to install LESS on my machine and accept installed node already. Notwithstanding, when I enter "node install -g less" I get the following fault 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 endeavour running this control again equally root/Administrator. npm ERR! Organisation Darwin 13.3.0 npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "less" npm ERR! cwd /usr/local/bin npm ERR! node -five v0.10.33 npm ERR! npm -5 i.4.28 npm ERR! path /usr/local/lib/node_modules/less npm ERR! code EACCES npm ERR! errno iii npm ERR! stack Fault: EACCES, unlink '/usr/local/lib/node_modules/less' npm ERR! error rolling dorsum Fault: EACCES, unlink '/usr/local/lib/node_modules/less' npm ERR! fault rolling back { [Error: EACCES, unlink '/usr/local/lib/node_modules/less'] npm ERR! error rolling dorsum errno: three, npm ERR! error rolling back code: 'EACCES', npm ERR! error rolling dorsum path: '/usr/local/lib/node_modules/less' } npm ERR! not ok code 0 This question is tagged with node.js linux less
~ Asked on 2014-10-28 15:48:08
~ Answered on 2014-12-31 17:00:06
Honestly this is bad advice from npm. An installation can run arbitrary scripts and running it with sudo can be extremely dangerous! You could do sudo npm install -chiliad less to install it globally, but instead I would recommend updating your npm settings:
#~/.npmrc prefix=~/.npm_modules Then you can update your path:
#~/.bashrc or ~/.zshrc, etc. export PATH=$PATH:$Dwelling/.npm_modules/bin And so y'all don't require root permissions to perform the installation and you tin still use the binary.
This would just apply to your user, yet. If you desire the entire arrangement to be able to use the module you would have to tell everyone to add your path. More complicated and robust solutions would include adding a folder with node modules / binaries that a grouping could install to and adding that to everyone's path.
~ Answered on 2014-10-28 xv:57:05
Just prepend sudo to the beginning of your command. As stated before, an installation runs some scripts that might be dangerous but I saw installing globally helps a lot and is style simpler.
Run sudo npm install -thou less
~ Answered on 2015-12-xv 08:29:13
This will definitely help. Respond by npm itself. https://docs.npmjs.com/getting-started/fixing-npm-permissions
Below is extracted from the URL for your convenience.
Option 1: Change the permission to npm's default directory
-
Find the path to npm'south directory:
npm config get prefix
For many systems, this will be /usr/local.
WARNING: If the displayed path is just /usr, switch to Option ii or you lot volition mess up your permissions.
-
Alter the possessor of npm's directories to the name of the electric current user (your username!):
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
This changes the permissions of the sub-folders used past npm and some other tools (lib/node_modules, bin, and share).
Choice 2: Change npm's default directory to another directory
-
Brand a directory for global installations:
mkdir ~/.npm-global -
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global' -
Open up or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH -
Dorsum on the command line, update your system variables:
source ~/.contour
Test: Download a package globally without using sudo.
`npm install -g jshint` Instead of steps 2-4, you lot tin use the corresponding ENV variable (e.g. if yous don't want to modify ~/.contour):
NPM_CONFIG_PREFIX=~/.npm-global
Choice 3: Utilise a package manager that takes care of this for you lot
If you're doing a fresh install of Node on Mac OS, you tin avoid this trouble altogether by using the Homebrew package manager. Homebrew sets things up out of the box with the right permissions.
mash install node
~ Answered on 2017-10-31 17:52:41
I kept having this trouble because windows was setting my node_modules folder to Readonly. Make sure you uncheck this.
~ Answered on 2017-11-14 17:46:52
This is what I had to do to get started with a Less compiler to avoid issues as mentionned in the OP:
- Install node.js
- Install NPM with Terminal:
sudo npm install npm -g - Install a Less compiler with Terminal:
sudo npm install -k less(the sudo makes all the departure) - If you're using PHPstorm: Get to "Preferences… > Plugins" and install NodeJS-plugin (might demand to "browse repositories" to find information technology) and restart PHPstorm (as prompted)
- After that become to Plugins once again: Install Less compiler (might need to "browse repositories" to notice it) and restart PHPstorm (every bit prompted)
- In one case you have a project set up, go to "Settings > Tools > Filewatchers" and add "Less". The path (of the "Program") should read something like this:
/usr/local/bin/lessc - Make sure Track just root files is checked in the settings of 6.
~ Answered on 2015-12-28 17:08:37
npm has an official folio about fixing npm permissions when y'all go the EACCES (Error: Access) error. The page even has a video.
Yous tin fix this trouble using one of two options:
- Modify the permission to npm's default directory.
- Change npm's default directory to some other directory.
~ Answered on 2016-03-ten 03:00:55
I was getting this upshot for instaling expo cli and I fixed past only following four steps mentioned in the npm documentation hither.
Problem is some version of npm fail to locate binder for global installations of parcel. Following these steps we can create or modify the .profile file in Home directory of user and give it a proper PATH there then it works similar a charm.
Attempt this it helped me and I spent around an hr for this consequence. My node version was half dozen.0
Steps I follow
Back up your computer. On the command line, in your home directory, create a directory for global installations:
mkdir ~/.npm-global
Configure npm to utilize the new directory path:
npm config set prefix '~/.npm-global'
In your preferred text editor, open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
On the command line, update your system variables:
source ~/.profile
To examination your new configuration, install a parcel globally without using sudo:
npm install -g jshint
~ Answered on 2020-ten-sixteen 07:47:20
In my example i needed to update the npm version from v.3.0 ? v.4.2 .
Before i could use this -- npm i -g npm .. i needed to run ii commands which perfectly solved my problem. It is highly likely that information technology will fifty-fifty solve your trouble.
Stride one: sudo chown -R $USER /usr/local
Step 2: npm install -1000 cordova ionic
Later on this you should update your npm to latest version
Stride 3: npm i -thou npm
Then you are good to go. Promise This solves your problem. Cheers!!
~ Answered on 2017-09-24 03:35:52
I also got the trouble. This is what I did:
- Uninstalled nodeJs from Control Panel > Uninstall a program
- At that place are 2 folders in users//appData/roaming --> npm folder and npm-cache folder. Delete both of these.
Now, become to nodeJS site, and install once more. Select 2d option in installation option (ie npm bundle). Install information technology. Y'all problem must be solved by now.
~ Answered on 2017-09-28 10:48:47
I know this is an one-time questions only none of the solutions seemed like a good practice hence I am putting how I have solved this outcome:
Tried solving this issue by using Homebrew simply it was also installing node in /usr/local directory which would once again crusade EACCES error.
Had to use a version manager like nvm for more informations run across the official npm guide.
For various operating system.
nvm installs node and it's modules in the user'due south HOME Folder thereby solving EACCES issues.
~ Answered on 2018-05-29 11:54:22
Source: https://syntaxfix.com/question/7283/please-try-running-this-command-again-as-root-administrator-error-when-trying-to-install-less
0 Response to "Please Try Running This Command Again as Root/administrator."
Post a Comment