Reputation: 22605
When I install a package using npm install command, it installs the files into ~/node_modules. When I run the package, I get command not found error.
How do I install it into a folder where I want to call the package?
Upvotes: 1
Views: 2234
Reputation: 1043
If you don't want to install it globally, the right answer is the last comment in the checked answer:
Simply add ./node_modules/.bin to your PATH, and all the commands installed locally by npm will be available. – H_I Dec 24 '12 at 9:54
You can add it to your path in your .bashrc file using the command: export PATH="$PATH:/home/login/node_modules/.bin"
Reload your .bashrc using: source .bashrc
Upvotes: 1
Reputation: 20463
npm install <name_of_package> -g
This will install the package globally. If the program is in your PATH
, then you should be able to run it just like any other program.
For example:
npm install nodemon -g
then run nodemon
from the command prompt, and it should work
Upvotes: 4