[英]npm install fails with message “Error: socket hang up”
I met this problem when execute the npm install module-name --save
我在执行npm install module-name --save
时遇到了这个问题
It fails no matter what I install. 无论我安装什么,它都会失败。
And it fails if I specified it in the package.json
. 如果我在package.json
指定它,它将失败。 and then run the npm install
for the whole project. 然后为整个项目运行npm install
。
There are some similar question posted like 也有类似的问题
NPM doesn't install any modules: network socket hangs up NPM没有安装任何模块:网络套接字挂起
NodeJS - What does "socket hang up" actually mean? NodeJS-“套接字挂起”实际上是什么意思?
but unfortunately, it doesn't work for me. 但不幸的是,它对我不起作用。 Also, npm install
is OK with my other projects. 另外,我的其他项目也可以npm install
。
My environment: npm v6.4.1, node.js v10.10.0 serverless v1.28.0 我的环境:npm v6.4.1,node.js v10.10.0无服务器v1.28.0
Appreciated for the help of any kinds. 感谢任何形式的帮助。
Here is my log message in my console: 这是控制台中的日志消息:
> spawn-sync@1.0.15 postinstall /Users/pro/node_modules/spawn-sync
> node postinstall
> serverless@1.28.0 postinstall /Users/pro/node_modules/serverless
> node ./scripts/postinstall.js
Error: socket hang up
at createHangUpError (_http_client.js:322:15)
at TLSSocket.socketOnEnd (_http_client.js:425:23)
at TLSSocket.emit (events.js:187:15)
at TLSSocket.EventEmitter.emit (domain.js:442:20)
at endReadableNT (_stream_readable.js:1092:12)
at process._tickCallback (internal/process/next_tick.js:63:19)
npm WARN cognito-backend@1.0.0 No description
npm WARN cognito-backend@1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! serverless@1.28.0 postinstall: `node ./scripts/postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serverless@1.28.0 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
I found a github issue that solves my problem: 我找到了一个解决我问题的github问题:
https://github.com/maciejtreder/ng-toolkit/issues/448 https://github.com/maciejtreder/ng-toolkit/issues/448
use nvm install v10.6.0
使用nvm install v10.6.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.