简体   繁体   English

npm安装错误/问题

[英]npm install error/issue

I have already set proxy configurations in .npmrc file. 我已经在.npmrc文件中设置了代理配置。 Executing the npm install command gives me error as follows" 执行npm install命令给我以下错误”

$ npm install npm ERR! $ npm install npm错误! Windows_NT 6.1.7601 npm ERR! Windows_NT 6.1.7601 npm错误! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" npm ERR! argv“ C:\\ Program Files \\ nodejs \\ node.exe”“ C:\\ Program Files \\ nodejs \\ node_modules \\ npm \\ bin \\ npm-cli.js”“安装” npm ERR! node v6.9.4 npm ERR! 节点v6.9.4 npm ERR! npm v3.10.10 npm ERR! npm v3.10.10 npm错误! code ECONNRESET 代码ECONNRESET

npm ERR! npm ERR! network tunneling socket could not be established, statusCode=400 npm ERR! 无法建立网络隧道套接字,statusCode = 400 npm ERR! network This is most likely not a problem with npm itself npm ERR! 网络这很可能不是npm本身的问题npm ERR! network and is related to network connectivity. 网络,并且与网络连通性有关。 npm ERR! npm ERR! network In most cases you are behind a proxy or have bad network settings. 网络在大多数情况下,您位于代理服务器后面或网络设置不正确。 npm ERR! npm ERR! network npm ERR! 网络npm ERR! network If you are behind a proxy, please make sure that the npm ERR! 网络如果您是代理人,请确保npm ERR! network 'proxy' config is set properly. 网络“代理”配置正确设置。 See: 'npm help config' 请参阅:“ npm帮助配置”

npm ERR! npm ERR! Please include the following file with any support request: npm ERR! 请在支持请求中包含以下文件:npm ERR! D:\\Pooja\\quickstart\\npm-debug.log d:\\普加\\快速入门\\ NPM-的debug.log

The .npmrc file in user folder contains following values 用户文件夹中的.npmrc文件包含以下值

 1. registry=https://registry.npmjs.org/
 2. proxy=http://proxy@domain.com:8080/
 3. http_proxy=http://username:password@proxy@domain.com:8080/

Is there any way to solve this issue? 有什么办法解决这个问题?

Does your proxy URL have '@' symbol in it? 您的代理URL中是否带有“ @”符号? @ symbol separates the user ID and password from the URL. @符号将用户ID和密码与URL分开。 If it does, you can try using '%40' to replace it. 如果是这样,您可以尝试使用'%40'替换它。

Also, it is https-proxy not http_proxy. 另外,它是https-proxy而不是http_proxy。

A correct config would look like - 正确的配置看起来像-

registry=https://registry.npmjs.org/
proxy=http://username:password@proxydomain:8080/
https-proxy=https://username:password@proxydomain:8080/

https://docs.npmjs.com/misc/config#proxy https://docs.npmjs.com/misc/config#proxy

first give the command and check if proxy is set, npm config get proxy if not set do the following from command prompt 首先给出命令并检查是否设置了npm config get proxy如果未设置npm config get proxy ,请从命令提示符处执行以下操作

npm config set proxy http://username:password@proxy address:8080 npm config set https-proxy http://username:password@proxy address:8080

and if password contains '@'in password, then replace it with '%40' 如果密码中包含“ @”,则将其替换为“%40”

Someone who comes from china may solve this problem by using Taobao mirror. 来自中国的人可以使用淘宝镜解决此问题。

npm --registry= https://registry.npm.taobao.org install npm --registry = https://registry.npm.taobao.org安装

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM