无法在Windows 7中运行全局安装的节点模块

时间:2022-02-10 15:13:04

Note: I have tried almost all similar posts related to this issue and found nothing was helpful to me. Hence posting this.

注意:我已经尝试了几乎所有与此问题相关的类似帖子,发现没有什么对我有帮助。因此张贴此。

Issue: I'm trying to install http-server package in my Windows 7 machine using npm install http-server -g, Installation was fine, however when I try to execute it using http-server command in the command line I'm getting an error saying, 'http-server' is not recognized as an internal or external command, operable program or batch file. I have also tried the same steps for gulp and the result was the same.

问题:我正在尝试使用npm install http-server -g在我的Windows 7机器上安装http-server软件包,安装很好,但是当我尝试在命令行中使用http-server命令执行它时我得到了错误说,'http-server'不被识别为内部或外部命令,可操作程序或批处理文件。我也为gulp尝试了相同的步骤,结果是一样的。

I have tried setting the Node Path as, set NODE_PATH=%AppData%\npm\node_modules; but no luck.

我尝试将节点路径设置为,设置NODE_PATH =%AppData%\ npm \ node_modules;但没有运气。

Can someone shed some light here?

有人可以在这里说清楚吗?

Thanks, Dave

谢谢,戴夫

1 个解决方案

#1


2  

Global packages needs to be installed using and administration console (CMD / Run as Administrator)

需要使用和管理控制台安装全局包(CMD /以管理员身份运行)

#1


2  

Global packages needs to be installed using and administration console (CMD / Run as Administrator)

需要使用和管理控制台安装全局包(CMD /以管理员身份运行)