Npm executes binaries as well when referenced in scripts section. No need to pollute the path variable. And path is global again. Npm is the package manager for JavaScript and the world’s largest software registry. Discover packages of reusable code — and assemble them in powerful new ways.
If you don't want to execute the npm -g
with root privileges, here's how to setup npm to support this.
1. Configure npm
npm reads settings from the .npmrc
file in your home directory. Create it with the following content:
This will tell npm to put all packages, which you install with the -g flag, into .npm/lib/node_modules
within your home directory.
Npm Install Local Package
2. Configure your $PATH
Some modules (like grunt) come with executable scripts. You probably want to be able to execute them without having to type the full path to .npm/lib/node_modules/...
. Thankfully, npm links every executable to .npm/bin
. So you just have to add this to your $PATH.
How To Install Node Modules Using Npm
Edit your ~/.bash_profile and add this line:
Npm Global Vs Local Install
That's it.