Gitlab CI issue installing serverless (works fine last week)

Not sure what is causing this but our CI jobs failed to work just this week. The same jobs that worked last week when retried also fails. Something is blocking the postinstall script of serverless when running. Image used is ‘node:10’

$ npm install serverless --save-dev

> spawn-sync@1.0.15 postinstall /builds/rceballosjr/juanride-sls/node_modules/spawn-sync
> node postinstall

> serverless@1.28.0 postinstall /builds/rceballosjr/juanride-sls/node_modules/serverless
> node ./scripts/postinstall.js

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)
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:
npm ERR!     /root/.npm/_logs/2018-07-24T02_32_55_250Z-debug.log
ERROR: Job failed: exit code 1


Do you have a proxy in your network?

Are you using a default npm registry or using nexus?

you can get what registry uses with:

npm config list

If you are using the default registry, and using https, you can change it to http

npm config set registry

I was running the CI from Gitlab’s Pipelines.

After doing some research on related issues with 10.7 npm issues on other plugins I connected the dots and found out that the fix is to pick a Docker image ‘node:10.6’ in Gitlab’s .gitlab-ci.yml file. I used to only specify ‘node:10’ picking the latest 10.7 image. The 10.7 has issues with TLS.