Node js EACCES error Ubuntu linux | Node npm global permission Ubuntu

preview_player
Показать описание
(A) change owner to user for .npm folder
$ sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}

$ sudo chown -R $(whoami) ~/.npm

If above command don't resolve error
then try (b)

(B)
[1]Open terminal in your home directory

create hidden folder
$ mkdir ~/.npm-global

step 2 Optional
[2] $ npm config get prefix

[3] $ npm config set prefix '~/.npm-global'

step 4 Optional (can skip) jump to step 5
set path in profile for particular shell instance
[4] $ export PATH=~/.npm-global/bin:$PATH

[5] add into ~/.profile or ~/.bashrc
$ nano ~/.profile or $ nano ~/.bashrc
$ export PATH="~/.npm-global/bin:$PATH"
$ source ~/.profile or $ nano ~/.bashrc

To check that it works correct $ npm install -g jshint
Рекомендации по теме