0

I met this problem when execute the npm install module-name --save

It fails no matter what I install.

And it fails if I specified it in the package.json . and then run the npm install for the whole project.

There are some similar question posted like

NPM doesn't install any modules: network socket hangs up

NodeJS - What does "socket hang up" actually mean?

but unfortunately, it doesn't work for me. Also, npm install is OK with my other projects.

My environment: npm v6.4.1, node.js v10.10.0 serverless 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:
pyy
  • 915
  • 3
  • 9
  • 25

1 Answers1

0

I found a github issue that solves my problem:

https://github.com/maciejtreder/ng-toolkit/issues/448

use nvm install v10.6.0

pyy
  • 915
  • 3
  • 9
  • 25