安装npm依赖包一直报错
发布于 8 年前 作者 dinghb 13841 次浏览 来自 问答

我在安装npm依赖包时,比如npm install express -g,他会显示安装错误,错误信息为:

C:\Windows\system32>npm install express -g npm ERR! Windows_NT 6.1.7601 npm ERR! argv “D:\Program Files\nodejs\node.exe” “D:\Program Files\nodejs\ node_modules\npm\bin\npm-cli.js” “install” “express” "-g" npm ERR! node v5.6.0 npm ERR! npm v3.6.0 npm ERR! code ECONNRESET

npm ERR! network tunneling socket could not be established, cause=write EPROTO 1 01057795:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:ope nssl\ssl\s23_clnt.c:794: npm ERR! network npm ERR! network This is most likely not a problem with npm itself npm ERR! network and is related to network connectivity. npm ERR! network In most cases you are behind a proxy or have bad network settin gs. 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! Please include the following file with any support request: npm ERR! C:\Windows\system32\npm-debug.log 我检查过我的代理是没有问题的,网络应该也没什么问题,请问有哪位大神可以指点一下?​

12 回复

openssl错误

@gzhangzy 我执行了nmake -f ms\ntdll.mak test看了下说nmake不是内部或外部命令,应该是我没有装openssl,而且我同事的电脑貌似也没有装,请问,是不是其他问题啊?

换linux或者mac 或者装个虚拟机 节省下来的时间不止一点半点

@yakczh 我也装过Linux的环境,但是很奇怪也是安装依赖包报错,下载失败。我都不知道是不是我哪个环境变量或者软件和这个有冲突。之前安装ceph的时候也是下载某个东西一直无法下载

ECONNRESET

给npm加个梯子试试

@magicdawn 请问梯子是什么意思?

试试taobao镜像

npm i nrm -g
nrm use taobao
npm i express -g

@haibinpark 谢谢提供的思路,不过第一个命令npm i nrm -g就报错了T^T

@magicdawn 我是用代理的,但是很奇怪就是下载不了这个

@dinghb

  1. 用 proxychains 试试,用法找谷歌
  2. kneesocks 试试
cnpm i kneesocks -g # 其他渠道安装 kneesocks
DEBUG=proxy kneesocks 10086 1080 # 启动 10086 端口的HTTP 代理,连接 1080的socks代理
npm config set proxy http://127.0.0.1:10086 # 使用代理

@dinghb 你还是用 cnpm 吧

npm install -g cnpm --registry=https://registry.npm.taobao.org
cnpm i express
回到顶部