Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
495 views
in Technique[技术] by (71.8m points)

windows - Global NPM package installed but command not found

I have globally installed two npm packages "download" and "enigmavirtualbox" via command line:

npm install -g download and npm install -g engimavirtualbox

I'm trying to use them in a batch file to bundle a single .exe file from my node project. For both, the commands npm list -g <packagename> yield the respective version output, independent of the present working directory.

However, inside my batch script the commands "download" and "enigmavirtualbox" cannot be found.

Running npm root -g yields C:Users<username>AppDataRoaming pm ode_modules and looking inside that folder I can see that folders for both packages are present.

What I have tried:

  • Changing npm root as described here
  • Uninstall and reinstall packages
  • Add env. variable NODE_PATH to point to C:Users<username>AppDataRoaming pm ode_modules
  • Add C:Users<username>AppDataRoaming pm ode_modules to PATH env. variable

The same setup works on my second computer (both run Win7 64bit). Is something wrong with my node installation, or what am I doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

The executable binaries and .cmd files end up in C:Users<username>AppDataRoaming pm (minus the node_modules at the end) so adding that path to the PATH env. variable fixed the issue.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...