Global Mode
suggest changeWith the default Unix prefix, global mode installs packages into /usr/local/lib/node_modules. npm root -g prints the prefix actually in use (it differs under nvm and on Windows). This command downloads the latest express into /usr/local/lib/node_modules/express:
$ npm install -g express
The install needs write access to that folder. Packages installed there are available to every Node process on the machine.
A local install downloads modules into a node_modules folder in the current directory. From /home/user/apps/my_app, npm creates /home/user/apps/my_app/node_modules if it does not already exist.
Found a mistake? Have a question or improvement idea?
Let me know.
Table Of Contents