运行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)下的环境变量中,也没有成功。
我做错了什么?
当前回答
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".
其他回答
尝试使用%AppData%\npm\设置系统变量路径。确保AppData文件夹的可见性。这个文件夹应该是可见的(而不是隐藏的)。
对我来说,PATH环境变量有问题。我删除了所有与npm相关的路径,并在path的开头添加了这个文件夹:
c:\Users\<your-user-name>\AppData\Roaming\npm\
确保你有;之间的路径。
在系统env设置中,将node_modules下的.bin文件夹中的ng命令路径添加到path变量。
例:将C:\testProject\node_modules\.bin\添加到PATH中
重新启动IDE。
我使用的是win10,只是为了解决这个问题。 在cmd中输入下面的代码:
NPM配置获取前缀
然后复制粘贴你从顶部得到的路径到你的计算机环境变量——>用户变量盒子——> path——> edit——C:\Program Files\nodejs\ node_global,你的路径可能不同。
点击确定并重新打开cmd窗口,输入ng版本,然后它就工作了!干杯!
安装x32版本的nodejs而不是x64版本(即使在64位windows机器上)。