运行windows 7 Professional 32bit。
我试着在normal或admin下运行npm install -g angular-cli。
我还尝试将它添加到PATH: (C:\Users\Administrator\AppData\Roaming\npm\node_modules\angular-cli\bin\ng)下的环境变量中,也没有成功。
我做错了什么?
运行windows 7 Professional 32bit。
我试着在normal或admin下运行npm install -g angular-cli。
我还尝试将它添加到PATH: (C:\Users\Administrator\AppData\Roaming\npm\node_modules\angular-cli\bin\ng)下的环境变量中,也没有成功。
我做错了什么?
当前回答
我在x86的windows 7上也遇到了同样的问题;
卸载@angular / cli 安装@angular / cli 检查和验证环境变量(没有问题)… 同样的问题:
解决方案是C:\Users{USERNAME} .npmrc文件…将前缀改为"prefix=${APPDATA}\npm"…感谢这个网站的帮助,解决这个问题
其他回答
我有同样的问题,Visual Studio代码不能在它的内置终端中运行任何ng命令。
我添加了%AppData%\npm到Windows 10的路径中,并且不需要重新启动,只是关闭和重新打开VS Code,它看不到它。
I was having the same issue when tried with the syntax "ng new " and solved that simply by updating the existing node version from 5.x.x to 8.x.x. After successful updation of node, the syntax worked perfectly for me. Please update the existing version of node. As it is clearly mentioned in angular documentation that these commands require the node version >= 6.9.x. For reference please check https://angular.io/guide/quickstart. It clearly states "Verify that you are running at least node 6.9.x and npm 3.x.x by running node -v and npm -v in a terminal/console window. Older versions produce errors, but newer versions are fine".
我在几天前解决了这个问题,在其他全局模块遇到同样的问题后,添加到:
环境表->系统变量->路径:
C:\Users\管理员\ AppData \漫游\ npm \ node_modules \ angular-cli \ bin, C: \ Program Files \ MongoDB \ Server \ 3.2 \ bin
注意,后面不能有空格;
这就是我的问题所在。
我使用的是win10,只是为了解决这个问题。 在cmd中输入下面的代码:
NPM配置获取前缀
然后复制粘贴你从顶部得到的路径到你的计算机环境变量——>用户变量盒子——> path——> edit——C:\Program Files\nodejs\ node_global,你的路径可能不同。
点击确定并重新打开cmd窗口,输入ng版本,然后它就工作了!干杯!
关闭CMD并再次以管理员权限打开或重新启动系统。