运行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)下的环境变量中,也没有成功。
我做错了什么?
当前回答
如果您在执行上述步骤后仍然得到错误。然后试试下面的建议。
因为它是一个节点脚本。我现在使用下面的选项来创建。
\ users \Administrator\AppData\Roaming\npm\node_modules\angular-cli\bin\ng版本
可能需要符号链接。没有进一步研究。
进一步研究: C:\Users\Administrator\AppData\Roaming\npm;
在Windows中,npm。CMD文件在上述路径下。如果设置了上述环境变量,则可以执行为 ng版本 ng init
其他回答
通过命令
npm install -g @angular/cli@latest
它工作得很好,我现在能够运行ng命令了。
设置路径= % %路径;C: \ \ \ AppData \ \ npm漫游用户
PATH环境变量需要更新,添加如下PATH,
C:\Users\xyzname\AppData\Roaming\npm\node_modules\@angular\cli\bin
因为ng文件在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".
在尝试更新Windows 7 (x64)上的PATH变量之前,运行CMD控制台AS ADMINISTRATOR和ng命令对我有用,这也适用于VISUAL STUDIO CODE控制台。
它为我工作在CMD控制台/ VS CODE