运行windows 7 Professional 32bit。

我试着在normal或admin下运行npm install -g angular-cli。

我还尝试将它添加到PATH: (C:\Users\Administrator\AppData\Roaming\npm\node_modules\angular-cli\bin\ng)下的环境变量中,也没有成功。

我做错了什么?


当前回答

我在几天前解决了这个问题,在其他全局模块遇到同样的问题后,添加到:

环境表->系统变量->路径:

C:\Users\管理员\ AppData \漫游\ npm \ node_modules \ angular-cli \ bin, C: \ Program Files \ MongoDB \ Server \ 3.2 \ bin

注意,后面不能有空格;

这就是我的问题所在。

其他回答

您可以这样办理登机手续。我也有同样的问题。首先,在环境变量中检查用户PATH。它必须指向%USERPROFILE%\AppData\Roaming\npm\node_modules\@angular\cli\

使用node.js命令提示符代替命令提示符。在安装的程序菜单中运行node.js命令提示符。点击开始,搜索node.js命令提示符。运行它,然后输入ng -v回车。它会起作用的。如果有帮助,请告诉我。

只需打开命令提示符(以管理员身份运行)。确保node——v高于6.9.0,npm——v高于3.0.0 r。

然后执行以下命令:

npm install -g @angular/cli

一旦安装了angular。你可以在路径中看到angular cli的条目

C:\Users\Dell\AppData\Roaming\npm\node_modules\@angular

那就试着帮忙。它会起作用的。

我也面临着同样的问题,但已经解决了。在我的最终原因是我安装节点和CLI使用其他用户配置文件,现在我从其他用户登录运行ng命令。由于节点和cli安装使用其他用户登录节点在C:\Users\<用户名>\AppData\漫游此路径上找不到任何东西,这就是为什么我得到这个错误。

我运行npm install -g @angular/cli命令并重启我的机器。一切都很正常。

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".

今天我也遇到了同样的问题,我走过了下面这条路—— (%USERPROFILE%\AppData\Roaming\npm),当我清除npm目录下的所有内容时,才知道有一些垃圾数据。现在当我运行(npm安装命令再次)。现在一切正常。