运行windows 7 Professional 32bit。

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

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

我做错了什么?


当前回答

NPM install -g @angular/cli代替了NPM install @angular/cli

其他回答

只需打开命令提示符(以管理员身份运行)。确保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

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

我在x86的windows 7上也遇到了同样的问题;

卸载@angular / cli 安装@angular / cli 检查和验证环境变量(没有问题)… 同样的问题:

解决方案是C:\Users{USERNAME} .npmrc文件…将前缀改为"prefix=${APPDATA}\npm"…感谢这个网站的帮助,解决这个问题

与其使用内置的命令提示符,不如开始使用NodeJS安装版本的命令提示符。然后它将完美地工作,没有任何问题。

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

我也遵循这个问题,所以我尝试了这个命令,它工作得很好。 使用命令:npm run ng