After upgrading Node, 'Segmentation fault (core dumped)' error shows up. How can I fix it?
Solution 1
I faced The same Issue just now, This because of conflicting the npm of node and nodejs
so remove nodejs by below commands
sudo apt-get remove nodejs
this will remove all nodejs related Packages,
after above command you have to run autoremove command just like that
sudo apt autoremove
this will solve the problem,
Now you just have node pacakge in your machine, and NPM (segmentation dumped) error will also resolves.
you can more dig about What is segmentation fault
Solution 2
Try to run npm rebuild
to recompile your dependencies.
Jeong Kim
Updated on June 17, 2022Comments
-
Jeong Kim almost 2 years
I was trying to upgrade Node by following the instruction from https://tecadmin.net/upgrade-nodejs-via-npm/. I did
sudo npm cache clean -f
,sudo npm install -g n
, andsudo n stable
. After the above commands, I stupidly didsudo ln -sf /usr/local/n/versions/node/11.8.0/bin/node /usr/bin/node
. After this command, I checked the/usr/local/n/versions/node
folder. It had10.15.3
, so I typedsudo ln -sf /usr/local/n/versions/node/10.15.3/bin/node /usr/bin/node
.Right now,
node -v
gives me10.15.3
. However,npm -version
gives meSegmentation fault (core dumped)
. Other commands likenpm update -g
also gives me the same error message.Other posts about the
Segmentation fault (core dumped)
error don't seem to be directly related to my problem.How can I fix this?
I am using Ubuntu 19.04.
Thank you.
-
Adarsh Sharma about 5 yearsI'm glad I could help.
-
Yusuf almost 4 yearsit removed all nodejs, npm, node for me. So had to install again
-
Monkey D. Luffy over 3 yearsNot working for me, can you help me a little bit here?
-
taper over 3 yearsThis works for me when my
npm pack
command failed. However, it does removes all npm related packages installed byapt-get
but since I manage npm using conda, this isn't an issue for me. -
LIU Qingyuan about 3 yearsThis must be the funniest error I can encounter in a released version of a famous software... Every execution of npm, with or without any options, yields segfault immediately, and it is resolved after remove all nodejs related packages as described in this answer.
-
Jack Steam about 2 yearsUsing pnpm,
pnpm rebuild
worked perfectly!