Netlify deploy always gives error 'script returned exit code 139' on jenkins

I’m using jenkins pipeline to build my sapper site and deploy it to netlify. The build is success and deployment is also success (verified by seeing console output and site url, deployment url). But after the message ‘deploy is live’ + logs, error is thrown and build is marked as failure.

log:
npm run netlify:deploy

> TODO@0.0.1 netlify:deploy /var/jenkins_home/workspace/deploy-s-pipeline

> netlify deploy --prod --dir=./__sapper__/export --auth=${NETLIFY_ACCESS_TOKEN} --site=${NETLIFY_SITE_ID}


Deploy path: /var/jenkins_home/workspace/deploy-s-pipeline/__sapper__/export

Deploying to main site URL...

- Hashing files...

✔ Finished hashing 80 files

- CDN diffing files...

✔ CDN requesting 3 files

- Uploading 3 files

✔ Finished uploading 3 assets

- Waiting for deploy to go live...

✔ Deploy is live!


Logs:              https://app.netlify.com/sites/<hidden>

Unique Deploy URL: https://<hidden>.netlify.app

Website URL:       https://<hidden>.netlify.app

Segmentation fault (core dumped)

npm ERR! code ELIFECYCLE

npm ERR! errno 139

npm ERR! TODO@0.0.1 netlify:deploy: `netlify deploy --prod --dir=./__sapper__/export --auth=${NETLIFY_ACCESS_TOKEN} --site=${NETLIFY_SITE_ID}`

npm ERR! Exit status 139

npm ERR! 

npm ERR! Failed at the TODO@0.0.1 netlify:deploy 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!     /var/jenkins_home/.npm/_logs/2020-11-15T04_58_08_516Z-debug.log

script returned exit code 139

jenkins server config: 4vCPU, 4 GB Ram

p.s: when I build and deploy the same repo with circle-ci, there is no error thrown

We can’t really provide tech support on your jenkins instance, but I think a good exercise would be to see if you use the same version of the CLI and node on jenkins and circle CI, since I bet they are different.

The CLI can run successfully in far less than 4Gb of memory on a single CPU machine, so it anyway isn’t about instance size (unless Circle lies and you really have a 4MByte machine or something, but I think that is unlikely :))