问题描述
Node JS和NPM之前运行良好.最近,我重新安装了Node JS,NPM,问题开始了.安装示例npm install -g bower
之类的模块后,该模块安装成功,但bower -v
给出了
Node JS and NPM was working well before. Recently I have re-installed the Node JS, NPM and the problem started. After I install a module like example npm install -g bower
, the module gets installed successfully but bower -v
gives
我已经检查了安装路径C:\Users\XXXXX\AppData\Roaming\npm\node_modules
具有所有旧的已安装模块.我尝试卸载它们并重新安装模块,但仍然出现相同的错误.
I have checked the installation pathC:\Users\XXXXX\AppData\Roaming\npm\node_modules
which has all the old installed modules. I have tried to uninstall them and reinstall the modules, but still I am getting the same error.
即使我已经删除了整个文件夹并再次安装了所有模块,但结果是相同的.
Even I have deleted the entire folder and installed all the modules again but the result is same.
我不知道为什么重新安装NodeJS NPM后会出现此错误.
I don't know why I am getting this error after reinstalling NodeJS NPM.
任何帮助将不胜感激.预先感谢.
Any help is greatly appreciated. Thanks in advance.
推荐答案
我遇到了同样的问题,并通过将'npm'目录添加到我的PATH中来解决了这个问题:
I had this same problem and fixed it by adding the 'npm' directory to my PATH:
右键单击我的电脑",然后转到属性>高级系统设置>环境变量".
Right click 'My Computer' and go to 'Properties > Advanced System Settings > Environment Variables'.
双击用户名的用户变量"部分下的PATH,然后添加"C:\ Users \用户名\ AppData \ Roaming \ npm",显然用您的用户名替换了用户名". 根据下面的注释,您可能需要将其添加到路径的顶部/顶部.
Double click on PATH under the 'User variables for Username' section, and add 'C:\Users\username\AppData\Roaming\npm' obviously replacing 'username' with yours. Based on comments below, you may need to add it to the top/front of your path.
重新启动控制台窗口或IDE,您应该从bower命令获得响应.
Restart your console window or IDE and you should get a response from the bower command.
这篇关于已安装节点JS NPM模块,但无法识别命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!