Node.js 运行命令npm install-g@angular\cli后,我收到一个npm ERR!本地代码

Node.js 运行命令npm install-g@angular\cli后,我收到一个npm ERR!本地代码,node.js,angular,npm,command-line-interface,Node.js,Angular,Npm,Command Line Interface,我最初使用的是一台运行windows 10的计算机,也在另一台运行windows 8.1的计算机上使用,但我仍然在这两台计算机上收到相同的消息。错误日志为: npm ERR! code ENOLOCAL npm ERR! Could not install from "@angular\cli" as it does not contain a package.json file. npm ERR! code EINVALIDTAGNAME npm ERR! Invalid tag name

我最初使用的是一台运行windows 10的计算机,也在另一台运行windows 8.1的计算机上使用,但我仍然在这两台计算机上收到相同的消息。错误日志为:

npm ERR! code ENOLOCAL
npm ERR! Could not install from "@angular\cli" as it does not contain a package.json file.
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "@angularcli": Tags may not have any characters that encodeURIComponent encodes.
node和npm版本分别为8.2.1和5.3.0

当我在gitbash上运行该命令时,我收到一条不同的错误消息。错误日志为:

npm ERR! code ENOLOCAL
npm ERR! Could not install from "@angular\cli" as it does not contain a package.json file.
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "@angularcli": Tags may not have any characters that encodeURIComponent encodes.
你的命令是错误的:

它是带有正斜杠的
@angular/cli
,而不是
@angular\cli

npm install -g @angular/cli
要在windows上安装angular cli,请使用


npm安装-g@angular/cli
代替
npm安装-g@angular-cli

尝试字符/not\
npm install -g @angular/cli