npm install命令不适用于代理

时间:2018-06-22 07:02:52

标签: angular npm-install

我需要在Windows系统中安装angular cli。但是无论如何,我尝试使用npm install命令安装angular cli时出现错误。我使用的是我学院的代理网络。i have atttched the scren shot here

5 个答案:

答案 0 :(得分:2)

尝试以下步骤

  1. npm config set strict-ssl false

然后将npm设置为使用http代替https:

  1. npm config set registry "http://registry.npmjs.org/"

然后我使用以下语法安装软件包:

  1. npm --proxy http://username:password@cacheaddress.com.br:80 \ install packagename
  

如果代理不需要您跳过用户名:密码部分,   验证

     

通过同时设置HTTP_PROXY和   HTTPS_PROXY环境变量,然后正常发出命令   npm install express(例如)

要了解有关在公司代理click here后面运行npm命令的更多信息

答案 1 :(得分:0)

使用如下所示的npm代理设置:

Http: $ npm config set proxy http://<username>:<password>@<proxy-server-url>:<port>

Https: $ npm config set https-proxy http://<username>:<password>@<proxy-server-url>:<port>

答案 2 :(得分:0)

尝试将代理设置为您的npm

npm config set proxy http://"username:password"@yourdomain:port
npm config set https-proxy http://"username:password"@yourdomain:port
npm config set registry=http://registry.npmjs.org/
npm config set strict-ssl=false 

答案 3 :(得分:0)

公司代理中都存在的系统需要分别设置npm代理。

npm使用配置文件(.npmrc文件)来应用代理设置,可以通过命令提示符对其进行修改。

尝试先设置代理,如下所示:

npm config set proxy http://proxy.company.com:8080
npm config set https-proxy http://proxy.company.com:8080

一一运行命令提示符中的命令。

希望它会有所帮助:)

答案 4 :(得分:0)

将这些命令运行为:

1 .npm config set strict-ssl false 然后将npm设置为使用http而不是https:

运行

2。 npm config设置注册表“ http://registry.npmjs.org/” 然后,我使用以下语法安装软件包:

  1. npm --proxy http://username:password@cacheaddress.com.br:80 \ 安装软件包名称 如果代理不需要您进行身份验证,请跳过username:password部分

    通过设置两个HTTP_PROXY和HTTPS_PROXY环境变量,然后正常发出命令npm install express

  2. ,可以使NPM在代理后面工作。

祝你好运

相关问题