node.js npm 安装角度/cli 错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/44405323/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-02 18:16:48  来源:igfitidea点击:

npm install angular/cli error

node.jsnpmangular-cli

提问by sahil

node -v 8and npm -v 5. Trying to install angular/cliglobally from yesterday. Facing new error everytime.

node -v 8和 npm -v 5。试图从昨天开始全局安装angular/cli。每次都面临新的错误。

Vipins-Air:~ vipingupta$ sudo npm install -g @angular/cli npm ERR! code ETIMEDOUT npm ERR! errno ETIMEDOUT npm ERR! network request to http://registry.npmjs.org/@angular%2fclifailed, reason: connect ETIMEDOUT 74.122.238.10:8080 npm ERR! network This is a problem related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settings. npm ERR! network npm ERR! network If you are behind a proxy, please make sure that the npm ERR! network 'proxy' config is set properly. See: 'npm help config' npm ERR! A complete log of this run can be found in: npm ERR! /Users/vipingupta/C:Devnodejsnpm-cache/_logs/2017-06-07T06_37_13_337Z-debug.log

Vipins-Air:~ vipingupta$ sudo npm install -g @angular/cli npm ERR!代码 ETIMEDOUT npm ERR!errno ETIMEDOUT npm 错误!对http://registry.npmjs.org/@angular%2fcli 的网络请求失败,原因:连接 ETIMEDOUT 74.122.238.10:8080 npm ERR!网络 这是一个与网络连接相关的问题。npm 错误!网络 在大多数情况下,您使用的是代理或网络设置不佳。npm 错误!网络 npm 错误!网络 如果您在代理后面,请确保 npm ERR!网络“代理”配置设置正确。请参阅:'npm help config' npm ERR!可以在以下位置找到此运行的完整日志:npm ERR!/Users/vipingupta/C:Devnodejsnpm-cache/_logs/2017-06-07T06_37_13_337Z-debug.log

回答by Vinothkumar

If you are getting the below message:

如果您收到以下消息:

npm ERR! network 'proxy' config is set properly. See: 'npm help config'

错误!网络“代理”配置设置正确。请参阅:'npm 帮助配置'

you need to set proxy

你需要设置代理

$ npm config set proxy http://XXX.XXX.XXX.XXX:XXXX

and

$ npm config set https-proxy http://XXX.XXX.XXX.XXX:XXXX

give your proxy ip address and port number(4digits)

提供您的代理IP地址和端口号(4位)

if you dont want to use proxy remove it using below command

如果您不想使用代理,请使用以下命令将其删除

$ npm config rm proxy   
$ npm config rm https-proxy

To check the current proxy

检查当前代理

$ npm config get proxy

回答by Gagan

Remove the proxies by running the following commands.

通过运行以下命令删除代理。

npm config rm proxy

npm config rm https-proxy

It should work now.

它现在应该可以工作了。

回答by Hicham AL AGAD

try

尝试

npm config set proxy http://USERNAME:PASS@IP_Address:PORT_NO/
  • don't delete http://
  • USERNAMEis your name in your physique machine
  • PASSis your password in your physical machine
  • 不要删除 http://
  • USERNAME你的名字在你的体质机器上吗
  • PASS是你物理机上的密码

After that try to install your packages for example: npm install -g @angular/cli

之后尝试安装您的软件包,例如: npm install -g @angular/cli

回答by Balki

1.) try "npm config set proxy http://USERNAME:PASs@IP_Address:PORT_NO/"

1.) 尝试“npm config set proxy http://USERNAME:PASs@IP_Address:PORT_NO/

2.) Make sure that the proxy is set by running the below command npm config get proxy

2.) 通过运行以下命令确保设置了代理 npm config get proxy

3.) After that when we try to install it was working fine.

3.) 之后,当我们尝试安装它时,它工作正常。

回答by TheBinaryGuy

Try to clean cache "npm cache clean"

尝试清理缓存“npm cache clean”

uninstall angular-cli "npm uninstall -g angular-cli"

卸载 angular-cli "npm uninstall -g angular-cli"

install again "npm install -g angular-cli"

再次安装“npm install -g angular-cli”

If this doesn't work, use Force flag (-f).

如果这不起作用,请使用强制标志 (-f)。

And also make sure your network connection is descent.

还要确保您的网络连接是下降的。