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

Published: 15 September 2020
on channel: sevansu
10,618
66

(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


On this page of the site you can watch the video online Node js EACCES error Ubuntu linux | Node npm global permission Ubuntu with a duration of hours minute second in good quality, which was uploaded by the user sevansu 15 September 2020, share the link with friends and acquaintances, this video has already been watched 10,618 times on youtube and it was liked by 66 viewers. Enjoy your viewing!