当我运行npm install
时出现以下错误。它似乎无法下载任何软件包。我使用节点8.2.1和npm 5.3.0
你知道出了什么问题吗?
npm ERR! code EPROTO
npm ERR! errno EPROTO
npm ERR! request to https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz failed,
reason: write EPROTO 140640770651968:error:140770FC:SSL
routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:797:
npm logs:
0215 verbose type system
20216 verbose stack FetchError: request to https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz failed, reason: write EPROTO 140640770651968:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:797:
20216 verbose stack
20216 verbose stack at ClientRequest.req.on.err (/home/pawel/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
20216 verbose stack at emitOne (events.js:115:13)
20216 verbose stack at ClientRequest.emit (events.js:210:7)
20216 verbose stack at onerror (/home/pawel/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/index.js:106:9)
20216 verbose stack at callbackError (/home/pawel/.nvm/versions/node/v8.2.1/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/https-proxy-agent/node_modules/agent-base/index.js:126:5)
20216 verbose stack at <anonymous>
20217 verbose cwd /home/pawel/work/react-components
20218 verbose Linux 4.4.0-83-generic
20219 verbose argv "/home/pawel/.nvm/versions/node/v8.2.1/bin/node" "/home/pawel/.nvm/versions/node/v8.2.1/bin/npm" "install"
20220 verbose node v8.2.1
20221 verbose npm v5.3.0
20222 error code EPROTO
20223 error errno EPROTO
20224 error request to https://registry.npmjs.org/mkdirp/-/mkdirp-0.5.1.tgz failed, reason: write EPROTO 140640770651968:error:140770FC:SSL routines:SSL23_GET_SERVER_HELLO:unknown protocol:../deps/openssl/openssl/ssl/s23_clnt.c:797:
20225 verbose exit [ 1, true ]
答案 0 :(得分:6)
我也有这个问题。以下技巧对我有用。
将node
和npm
版本升级到最新版本会更好。之后请按照以下步骤操作。
尝试从终端运行curl https://registry.npmjs.org/package-name
,以确保网络呼叫不会阻止对npm
注册表的程序包请求。
如果您在proxy
后面运行,则还必须配置npm
才能使用它,您可以使用以下设置:
npm config set proxy http://proxyhost:proxyport
npm config set http-proxy http://proxyhost:proxyport
npm config set https-proxy http://proxyhost:proxyport
npm config set registry http://registry.npmjs.org/
希望上述技巧可以解决您的问题。