If you want to use global path with npm, not local.
1. Install npm 2. `npm install -g {modules}` - Sometimes it gets permission error-> Comfirm path with `npm -g list`
-> change the permission of the directory
WARNING: If the displayed path is just /usr, switch to Option 2 or you will mess up your permissions.
-> sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
-
try to run the module
{module} --version
- when it gets an error
{module} command not found
try to run:
export PATH=(npm config get prefix)/{lib/node_modules,bin,share}:$PATH > ~/.profile
source ~/.profile
Make sure there is a path in.profile
- when it gets an error
It will work.