全球安装包NPM命令,但没有找到 [英] Global NPM package installed but command not found
问题描述
我已经在全球安装了两个故宫的包下载和的enigmavirtualbox通过命令行:
I have globally installed two npm packages "download" and "enigmavirtualbox" via command line:
NPM安装-g下载
和 NPM安装-g engimavirtualbox
我试图用它们在批处理文件从我的节点项目捆绑一个.exe文件。对于这两种情况下,命令 NPM列表-g<软件包名方式>
生成各自版本的输出,独立于present工作目录
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.
不过,我的批处理脚本中的命令下载和enigmavirtualbox不能被发现。
However, inside my batch script the commands "download" and "enigmavirtualbox" cannot be found.
运行 NPM根-g
收益率 C:\\用户\\&lt;用户名&GT; \\应用程序数据\\漫游\\故宫\\ node_modules
并期待该文件夹内,我可以看到,这两个软件包文件夹是present。
Running npm root -g
yields C:\Users\<username>\AppData\Roaming\npm\node_modules
and looking inside that folder I can see that folders for both packages are present.
我曾尝试:
- 更改
NPM根
描述这里 - 卸载并重新安装包
- 添加ENV。变量NODE_PATH指向
C:\\用户\\&lt;用户名&GT; \\应用程序数据\\漫游\\故宫\\ node_modules
- 添加
C:\\用户\\&lt;用户名&GT; \\应用程序数据\\漫游\\故宫\\ node_modules
到PATH环境。变量
- Changing
npm root
as described here - Uninstall and reinstall packages
- Add env. variable NODE_PATH to point to
C:\Users\<username>\AppData\Roaming\npm\node_modules
- Add
C:\Users\<username>\AppData\Roaming\npm\node_modules
to PATH env. variable
同样的装置作品在我的第二台计算机上(包括运行Win7的64位)。有什么问题我的节点安装,或者是我做错了?
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?
推荐答案
可执行二进制文件和.cmd文件的在结束了 C:\\用户\\&lt;用户名&GT; \\应用程序数据\\漫游\\ NPM
(减去 node_modules
末),以便补充说路径PATH环境。变量固定的问题。
The executable binaries and .cmd files end up in C:\Users\<username>\AppData\Roaming\npm
(minus the node_modules
at the end) so adding that path to the PATH env. variable fixed the issue.
这篇关于全球安装包NPM命令,但没有找到的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!