snap: npm Segmentation Fault

Running commands like npm install causes a segmentation fault out of the box. This is how I installed the snap:

sudo snap install node --classic

This is the verbose logs:

[dylhack@840G6 test]$ npm i --verbose
npm info it worked if it ends with ok
npm verb cli [
npm verb cli   '/var/lib/snapd/snap/node/5485/bin/node',
npm verb cli   '/snap/node/5485/bin/npm',
npm verb cli   'i',
npm verb cli   '--verbose'
npm verb cli ]
npm info using npm@6.14.15
npm info using node@v14.18.1
npm verb npm-session d9dfc4fb0ab4e7cf
npm info lifecycle test@1.0.0~preinstall: test@1.0.0
npm timing stage:loadCurrentTree Completed in 10ms
npm timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
npm timing stage:loadIdealTree:loadShrinkwrap Completed in 1ms
npm timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 3ms
npm timing stage:loadIdealTree Completed in 7ms
npm timing stage:generateActionsToTake Completed in 5ms
npm verb correctMkdir /home/dylhack/.npm/_locks correctMkdir not in flight; initializing
npm verb lock using /home/dylhack/.npm/_locks/staging-00e589a355f4ba29.lock for /home/dylhack/test/node_modules/.staging
npm verb unlock done using /home/dylhack/.npm/_locks/staging-00e589a355f4ba29.lock for /home/dylhack/test/node_modules/.staging
npm timing stage:executeActions Completed in 22ms
npm timing stage:rollbackFailedOptional Completed in 12ms
npm info linkStuff test@1.0.0
npm info lifecycle test@1.0.0~install: test@1.0.0
Segmentation fault (core dumped)

Versions NPM 6.14.15 NodeJS v14.18.1

About this issue

  • Original URL
  • State: open
  • Created 3 years ago
  • Reactions: 1
  • Comments: 16 (5 by maintainers)

Most upvoted comments

Sorry, I’m not at all sure what’s going on here. Maybe this is something best taken up with the Snap folks @ https://forum.snapcraft.io/? It sounds like an odd interaction with the distro you’re using. Maybe Snap isn’t setting up its environment properly. I suspect an important bit of information is the base, I think that our Node 14 snap is defaulting to “core16” (https://github.com/nodejs/snap/blob/node14/snapcraft.yaml) while 16 and above are explicitly set to “core20” (https://github.com/nodejs/snap/blob/node16/snapcraft.yaml - not the 18 that I suggested above). But even there, if there was something wrong with the linking isolation then I’d have thought the older one, compiled and linking against older libraries, should be safer with the newer distro version. I’m at a loss, sorry 🤷.