73nko
2/25/2018 - 12:25 PM

Change the npm path

Comand to change the npm path from root to local user

###Commands to change the local path

test@ubuntu-s-1vcpu-2gb-lon1-01:~$ mkdir ~/.npm-global test@ubuntu-s-1vcpu-2gb-lon1-01:~$ npm config set prefix '~/.npm-global' test@ubuntu-s-1vcpu-2gb-lon1-01:~$ export PATH=~/.npm-global/bin:$PATH test@ubuntu-s-1vcpu-2gb-lon1-01:~$ source ~/.profile

-First make sure the path is not correct

~$> npm config get prefix // /usr

-Then create a new folder .npm-global

~$> mkdir ~/.npm-global

-Set the prefix for the npm config to this new folder

~$> npm config set prefix '~/.npm-global'

-Edit your .profile file and export the new npm path

~$> vi .profile
// in last line of document add 
export PATH=~/.npm-global/bin:$PATH

-Rerun your .profile configuration

~$> source ~/.profile