Create an account

Very important

  • To access the important data of the forums, you must be active in each forum and especially in the leaks and database leaks section, send data and after sending the data and activity, data and important content will be opened and visible for you.
  • You will only see chat messages from people who are at or below your level.
  • More than 500,000 database leaks and millions of account leaks are waiting for you, so access and view with more activity.
  • Many important data are inactive and inaccessible for you, so open them with activity. (This will be done automatically)


Thread Rating:
  • 195 Vote(s) - 3.66 Average
  • 1
  • 2
  • 3
  • 4
  • 5
npm install -g less does not work: EACCES: permission denied

#1
I'm trying to set up less on phpstorm so I can compile .less files to .css on save. I have installed node.js and the next step (according to this [

[To see links please register here]

][1]) is running this command in the terminal

npm install -g less

However when I do this I get these errors

☁ ~ npm install -g less
npm WARN install Couldn't install optional dependency: EACCES: permission denied, mkdir '/Users/brentscholl/.npm/mkdirp/0.5.1'
npm WARN install Couldn't install optional dependency: EACCES: permission denied, mkdir '/Users/brentscholl/.npm/graceful-fs/3.0.8'
npm WARN install Couldn't install optional dependency: EACCES: permission denied, mkdir '/Users/brentscholl/.npm/extend/3.0.0'
npm WARN install Couldn't install optional dependency: EACCES: permission denied, mkdir '/Users/brentscholl/.npm/readable-stream/2.0.4'
npm WARN install Couldn't install optional dependency: EACCES: permission denied, mkdir '/Users/brentscholl/.npm/chalk/1.1.1'
npm WARN install Couldn't install optional dependency: EACCES: permission denied, mkdir '/Users/brentscholl/.npm/xtend/4.0.1'
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└─┬ [email protected]
├─┬ [email protected]
│ └── [email protected]
├── [email protected]
├── [email protected]
├─┬ [email protected]
│ └── [email protected]
└─┬ [email protected]
└── [email protected]

npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "less"
npm ERR! node v5.0.0
npm ERR! npm v3.3.6
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access

npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! at Error (native)
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR! /Users/brentscholl/npm-debug.log


I'm a complete noob here and not sure what to do next. Any help would be very appreciated!


[1]:

[To see links please register here]

Reply

#2
Run these commands in a terminal window (note: DON'T replace the $USER part... thats a linux command to get your user!):

sudo chown -R $USER ~/.npm
sudo chown -R $USER /usr/lib/node_modules
sudo chown -R $USER /usr/local/lib/node_modules
Reply

#3
Reinstall node and npm with **Node Version Manger** (as per [written in npm documentation][1]) to avoid permission errors:

In OSX:

curl -o-

[To see links please register here]

| bash

or follow this article:

[To see links please register here]


*Windows users should install [nvm-windows][3].
For further help how to install nvm refer the [nvm readme][2].*

Then choose for example:

nvm install 8.0.0
nvm use 8.0

Now you can give another try:

npm install -g less



[1]:

[To see links please register here]

[2]:

[To see links please register here]

[3]:

[To see links please register here]

Reply

#4
Using sudo is not recommended. It may give you permission issue later.
While the above works, I am not a fan of changing folders owned by root to be writable for users, although it may only be an issue with multiple users.
To work around that, you could use a group, with 'npm users' but that is also more administrative overhead.
See here for the options to deal with permissions from the documentation:

[To see links please register here]


I would go for option 2:

> To minimize the chance of permissions errors, you can configure npm to
> use a different directory. In this example, it will be a hidden
> directory on your home folder.
>
> Make a directory for global installations:
>
> mkdir ~/.npm-global
>
> Configure npm to use the new directory path:
>
> npm config set 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 ~/.profile
>
> Test: Download a package globally without using sudo.
>
> npm install -g jshint
>
> If still show permission error run (mac os):
>
> sudo chown -R $USER ~/.npm-global

This works with the default ubuntu install of:

sudo apt-get install nodejs npm

I recommend `nvm` if you want more flexibility in managing versions:

[To see links please register here]


On MacOS use brew, it should work without `sudo` out of the box if you're on a recent `npm` version.
Enjoy :)
Reply

#5
**Mac OS X Answer**

You don't have write access to the node_modules directory

npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules

Add your User to the directory with write access

1. Open folder containing node_modules

open /usr/local/lib/
2. Do a cmd+I on the node_modules folder to open the permission dialog
3. Add your user to have read and write access in the sharing and permissions section
[![enter image description here][1]][1]


[1]:
Reply

#6
For my mac environment

sudo chown -R $USER /usr/local/lib/node_modules

solve the issue
Reply

#7
In linux make sure getting all authority with:

sudo su
Reply

#8
Another option is to download and install a new version using an installer.

[

[To see links please register here]

][1]


[1]:

[To see links please register here]

Reply

#9
[![enter image description here][1]][1]Use sudo -i to switch to $root, then execute npm install -g xxxx


[1]:
Reply

#10
I have tried all the suggested solutions but nothing worked.

I am using macOS Catalina 10.15.3

Go to /usr/local/

Select bin folder > Get Info

Add your user to Sharing & Permissions.
Read & Write Permissions.
[![enter image description here][1]][1]


[1]:

And go to terminal and run npm install -g @ionic/cli

It has helped me.
Reply



Forum Jump:


Users browsing this thread:
1 Guest(s)

©0Day  2016 - 2023 | All Rights Reserved.  Made with    for the community. Connected through