Node.js 无法安装"@角度/cli“;

Node.js 无法安装"@角度/cli“;,node.js,angular,typescript,npm-install,Node.js,Angular,Typescript,Npm Install,我正在尝试使用npm安装-g@angular/cli安装@angular/cli。 但此尝试提供了一些错误消息 我的节点和npm版本如下所述 C:\WINDOWS\system32>node -v v 12.4.0 C:\WINDOWS\system32>npm -v 'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules\npm\bin\npm-cli.js" pre

我正在尝试使用npm安装-g@angular/cli安装@angular/cli。
但此尝试提供了一些错误消息

我的节点和npm版本如下所述

C:\WINDOWS\system32>node -v  
v 12.4.0

C:\WINDOWS\system32>npm -v  
'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g is not recognized as an internal or external command,
operable program or batch file.
6.9.0
我使用的是Windows10操作系统

当我尝试安装angular cli时,收到以下错误消息

C:\WINDOWS\system32>npm install -g @angular/cli
'CALL "C:\Program Files\nodejs\\node.exe" "C:\Program Files\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\me\AppData\Roaming\npm\ng -> C:\Users\me\AppData\Roaming\npm\node_modules\@angular\cli\bin\ng

> @angular/cli@8.0.2 postinstall C:\Users\me\AppData\Roaming\npm\node_modules\@angular\cli
> node ./bin/postinstall/script.js

npm ERR! file C:\WINDOWS\system32\cmd.exe;
npm ERR! path C:\WINDOWS\system32\cmd.exe;
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn C:\WINDOWS\system32\cmd.exe;
npm ERR! @angular/cli@8.0.2 postinstall: `node ./bin/postinstall/script.js`
npm ERR! spawn C:\WINDOWS\system32\cmd.exe; ENOENT
npm ERR!
npm ERR! Failed at the @angular/cli@8.0.2 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

在这种情况下,由于系统变量中路径末尾的分号而发生错误

ComSpec路径C:\Windows\System32\cmd.exe


从路径中删除分号对我很有效。

尝试升级到节点v12.4。Angular 8需要最新版本的node。我可以使用node v8.11安装。请尝试
npm cache clear
并运行
npm i-g@Angular/cli
命令我认为环境变量中缺少文件路径检查此项可能会有所帮助