Npm Err! Please Try Running This Command Again as Rootadministrator On Mac
I'm trying to install LESS on my motorcar and have installed node already. Notwithstanding, when I enter "node install -g less" I get the following error and am non sure what to do?
FPaulMAC:bin paul$ npm install -m 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: three, npm ERR! code: 'EACCES', npm ERR! path: '/usr/local/lib/node_modules/less' } npm ERR! npm ERR! Delight try running this command again as root/Administrator. npm ERR! Organisation Darwin xiii.3.0 npm ERR! command "node" "/usr/local/bin/npm" "install" "-one thousand" "less" npm ERR! cwd /usr/local/bin npm ERR! node -v v0.10.33 npm ERR! npm -five 1.iv.28 npm ERR! path /usr/local/lib/node_modules/less npm ERR! code EACCES npm ERR! errno 3 npm ERR! stack Mistake: 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 dorsum { [Error: EACCES, unlink '/usr/local/lib/node_modules/less'] npm ERR! error rolling back errno: 3, npm ERR! error rolling dorsum lawmaking: 'EACCES', npm ERR! error rolling back 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
tin can be extremely dangerous! Y'all could do sudo npm install -thou less
to install information technology 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:$Home/.npm_modules/bin
Then you lot don't require root permissions to perform the installation and you can still use the binary.
This would only use to your user, however. If you want the unabridged arrangement to exist able to use the module you would accept to tell anybody 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 15:57:05
Just prepend sudo
to the get-go 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 manner simpler.
Run sudo npm install -g less
~ Answered on 2015-12-15 08:29:xiii
This will definitely help. Answer past npm itself. https://docs.npmjs.com/getting-started/fixing-npm-permissions
Below is extracted from the URL for your convenience.
Option i: Alter the permission to npm'south default directory
-
Notice the path to npm's directory:
npm config get prefix
For many systems, this will be /usr/local.
Alert: If the displayed path is just /usr, switch to Option 2 or you will mess upwardly your permissions.
-
Change the owner of npm's directories to the name of the current user (your username!):
sudo chown -R $(whoami) $(npm config become prefix)/{lib/node_modules,bin,share}
This changes the permissions of the sub-folders used by npm and some other tools (lib/node_modules, bin, and share).
Option 2: Change npm's default directory to another directory
-
Make a directory for global installations:
mkdir ~/.npm-global
-
Configure npm to use the new directory path:
npm config prepare prefix '~/.npm-global'
-
Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
-
Back 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 can employ the corresponding ENV variable (due east.thou. if you don't want to modify ~/.contour
):
NPM_CONFIG_PREFIX=~/.npm-global
Option 3: Apply a package director that takes intendance of this for you
If you're doing a fresh install of Node on Mac Os, you can avoid this problem altogether by using the Homebrew parcel managing director. Homebrew sets things upward out of the box with the correct permissions.
mash install node
~ Answered on 2017-10-31 17:52:41
I kept having this problem considering windows was setting my node_modules
folder to Readonly. Make certain you uncheck this.
~ Answered on 2017-11-fourteen 17:46:52
This is what I had to practice to get started with a Less compiler to avoid bug equally 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 -g less
(the sudo makes all the difference) - If y'all're using PHPstorm: Go to "Preferences… > Plugins" and install NodeJS-plugin (might demand to "browse repositories" to find it) and restart PHPstorm (every bit prompted)
- After that go to Plugins again: Install Less compiler (might need to "browse repositories" to detect it) and restart PHPstorm (as prompted)
- Once yous have a project set up, become to "Settings > Tools > Filewatchers" and add "Less". The path (of the "Program") should read something like this:
/usr/local/bin/lessc
- Brand sure Track only root files is checked in the settings of 6.
~ Answered on 2015-12-28 17:08:37
npm has an official page most fixing npm permissions when yous get the EACCES (Error: Access) fault. The page even has a video.
You tin fix this problem using i of two options:
- Change the permission to npm'due south default directory.
- Modify npm's default directory to another directory.
~ Answered on 2016-03-10 03:00:55
I was getting this issue for instaling expo cli and I fixed by simply following four steps mentioned in the npm documentation here.
Problem is some version of npm neglect to locate folder for global installations of packet. Following these steps we can create or modify the .profile file in Dwelling directory of user and give information technology a proper PATH there so it works like a charm.
Try this it helped me and I spent around an hr for this consequence. My node version was six.0
Steps I follow
Dorsum upwards your computer. On the command line, in your home directory, create a directory for global installations:
mkdir ~/.npm-global
Configure npm to apply 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 test your new configuration, install a package globally without using sudo:
npm install -1000 jshint
~ Answered on 2020-10-16 07:47:20
In my example i needed to update the npm version from five.3.0 ? 5.4.2 .
Before i could utilize this -- npm i -g npm
.. i needed to run two commands which perfectly solved my problem. It is highly likely that it will fifty-fifty solve your problem.
Step 1: sudo chown -R $USER /usr/local
Stride 2: npm install -g cordova ionic
After this yous should update your npm to latest version
Footstep 3: npm i -k npm
Then yous are good to go. Hope This solves your problem. Cheers!!
~ Answered on 2017-09-24 03:35:52
I also got the problem. This is what I did:
- Uninstalled nodeJs from Control Panel > Uninstall a program
- There are 2 folders in users//appData/roaming --> npm folder and npm-enshroud binder. Delete both of these.
Now, go to nodeJS site, and install again. Select 2d option in installation option (ie npm package). Install it. You problem must be solved by now.
~ Answered on 2017-09-28 10:48:47
I know this is an erstwhile questions but none of the solutions seemed like a good practice hence I am putting how I have solved this issue:
Tried solving this outcome past using Homebrew but it was likewise installing node in /usr/local directory
which would over again cause EACCES
fault.
Had to use a version manager similar nvm for more than informations meet the official npm guide.
For diverse operating arrangement.
nvm installs node and it'south modules in the user'south Dwelling house Binder 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
Belum ada Komentar untuk "Npm Err! Please Try Running This Command Again as Rootadministrator On Mac"
Posting Komentar