Reputation: 24636
When I run npm install -g <package>
it installs the packages in my user/AppData/Roaming/npm/npm_modules/ folder. This sub-folder is not in my PATH so if I try to run the package without explicitly calling the entire path the call fails with a '<package>' is not recognized as an internal or external command, operable program or batch file.
What can I do to fix this?
Thanks
Upvotes: 30
Views: 34092
Reputation: 3847
I'm using win8.1 and I found that the nodejs installer didn't add the path to global node modules to the system PATH. Just add %AppData%\npm;
to the user variable(since %AppData% dir is depending on user) PATH
to fix it.
You will need to log out then log back in for the change to your PATH variable to take effect.
SET PATH=%AppData%\npm;%PATH%
Upvotes: 39
Reputation: 24636
It turned the problem was a change in behavior of the module I was using.
I'd been following old tutorials for using Express.js. The old tutorials assumed Express would be in my path after installing it globally, but as of Express v4.0 there's a separate Express module you have to install in order to get it in your path
Upvotes: 0
Reputation: 147
You have to run this line SET PATH=pathtonodejs;%PATH%
(where pathtonodejs
is where you installed nodejs) once the installation for nodejs is complete and it should work.
Upvotes: 2