for some packages I need to run sudo npm install -g, but for others it npm installwill be enough.
sudo npm install -g
npm install
Why and what is the difference?
For example:
npm install -g grunt-cli # doesn't work sudo npm install -g grunt-cli # works npm install websocket-stream # works
Is it required sudoonly with a flag -g?
sudo
-g
npm , .. node_modules . , . . Isaac ( ), , npm .
npm
node_modules
, , grunt-cli, mocha json. , , -g.
grunt-cli
mocha
json
, sudo , . .
-g , .
sudo, , .
npm install -g grunt-cli , . -g . root, sudo -g. npm -g, , sudo . .
npm install -g grunt-cli
grunt-cli , PATH, , , root-.. npm, sudo npm.
PATH
websocket-stream - , , , node_modules.
websocket-stream
. -g ( "root" ), root :
sudo chown -R `whoami` ~/.npm