Failed to globally install serverless on node 10.7

Hi All,

I recently found an issue when globally install serverless.

I could see that it is failing on Serverless post-installation steps. But I don’t actually know what to interpret from the information I’ve been given. Could someone give me a pointer on this issue?

As for the information of my stack, I am running Node on a Python Virtual Environment.


Another screenshot of the npm log file attached here.

The problem was with the Node version 10.7. Running this on the LTS version of Node works fine.

Also having this issue in macOS 10.13.6:

node -v

npm -v

npm install -g serverless@1.26.1
/usr/local/bin/serverless -> /usr/local/lib/node_modules/serverless/bin/serverless
/usr/local/bin/slss -> /usr/local/lib/node_modules/serverless/bin/serverless
/usr/local/bin/sls -> /usr/local/lib/node_modules/serverless/bin/serverless

> spawn-sync@1.0.15 postinstall /usr/local/lib/node_modules/serverless/node_modules/spawn-sync
> node postinstall

> serverless@1.26.1 postinstall /usr/local/lib/node_modules/serverless
> node ./scripts/postinstall.js

      throw er; // Unhandled 'error' event

Error: socket hang up
    at createHangUpError (_http_client.js:313:15)
    at TLSSocket.socketOnEnd (_http_client.js:416:23)
    at TLSSocket.emit (events.js:187:15)
    at TLSSocket.EventEmitter.emit (domain.js:442:20)
    at endReadableNT (_stream_readable.js:1081:12)
    at process._tickCallback (internal/process/next_tick.js:63:19)
Emitted 'error' event at:
    at TLSSocket.socketOnEnd (_http_client.js:416:9)
    at TLSSocket.emit (events.js:187:15)
    [... lines matching original stack trace ...]
    at process._tickCallback (internal/process/next_tick.js:63:19)
npm ERR! errno 1
npm ERR! serverless@1.26.1 postinstall: `node ./scripts/postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the serverless@1.26.1 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.


Bug reports need to go to Github. There’s already an issue for it.

I had the same exact issue! In my case it turned out that I had different sls versions installed (^1.26.1 in my package.json and 1.32.0 globally). So I just edited the one in my json file to match the global version.