Gitlab CI fails to install and run serverless with

We started to have problems with our Gitlab CI deployments just this week. I am posting this same question on the gitlab forums too but I’d likely have more chances of getting similar issues (and hopefully fix) here than there if anyone’s using Gitlab CI.

$ 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

Hi I encounter the same problem when I install other dependencies, how do you solve this issue?