无法安装"@ angular/cli" [英] unable to install "@angular/cli"

查看:103
本文介绍了无法安装"@ angular/cli"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

I am trying to install @angular/cli using the npm install -g @angular/cli.
But this try provides some error messages.

我的节点和npm版本在下面提到,

my node and npm versions are mentioned below,

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操作系统

I am using Windows10 operating system

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

When I am trying to install angular cli I got the following error messages

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.

推荐答案

在这种情况下,由于系统变量路径末尾的分号引起了错误.

In this case the error occurs because of the semicolon at the end of the path in System variables.

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

ComSpec path C:\Windows\System32\cmd.exe;

从路径中删除分号对我有用.

Removing semicolon from the path works for me.

这篇关于无法安装"@ angular/cli"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆