npm安装错误/问题

问题描述 投票:2回答:3

我已经在.npmrc文件中设置了代理配置。执行npm install命令会给出如下错误“

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

错误的ERR!无法建立网络隧道套接字,statusCode = 400 npm ERR!网络这很可能不是npm本身的问题npm ERR!网络并与网络连接有关。错误的ERR!网络在大多数情况下,您在代理后面或网络设置不良。错误的ERR!网络npm ERR!网络如果您在代理服务器后面,请确保npm ERR!网络'代理'配置设置正确。请参阅:'npm help config'

错误的ERR!请在任何支持请求中包含以下文件:npm ERR! d:\普加\快速入门\ NPM-的debug.log

用户文件夹中的.npmrc文件包含以下值

 1. registry=https://registry.npmjs.org/
 2. proxy=http://[email protected]:8080/
 3. http_proxy=http://username:password@[email protected]:8080/

有什么方法可以解决这个问题吗?

javascript npm npm-install http-proxy npm-config
3个回答
2
投票

您的代理网址中是否包含“@”符号? @符号将用户ID和密码与URL分开。如果是,您可以尝试使用'%40'来替换它。

此外,它是https-proxy而不是http_proxy。

正确的配置看起来像 -

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


1
投票

首先给出命令并检查是否设置了代理,如果没有设置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

如果密码中包含“@”,则将其替换为“%40”


0
投票

来自中国的人可以使用淘宝镜来解决这个问题。

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

© www.soinside.com 2019 - 2024. All rights reserved.