Error: EACCES: permission denied, access '/usr/local/lib/node_modules'

created at 07-10-2021 views: 4

error description

When Mac used npm to install the package npm i -g xxxx, it reported an error: 

Error: EACCES: permission denied, access'/usr/local/lib/node_modules'

solution

It can be seen from the error message that our operation lacks authority, and we can prescribe the right medicine, so we only need to give the administrator authority when executing the command.

Add sudo in front of the command line to get administrator privileges, just enter the administrator password.

That is, change 

npm i -g xxxx 

to 

sudo npm i -g xxxx 

and then enter the password.

npm
Please log in to leave a comment.