[英]I get segmentation fault whenever I try to use NPM or nodejs. Uninstalling and reinstalling doesn't fix it
I tried to update nodejs using the following:我尝试使用以下内容更新 nodejs:
$ sudo npm cache clean -f
$ sudo npm install -g n
$ sudo n stable
I have always successfully used this to update nodejs, however, the update failed this time.我一直成功地使用它来更新nodejs,但是,这次更新失败了。 Now, whenever I run NPM or nodejs, I get a segmentation fault.
现在,每当我运行 NPM 或 nodejs 时,都会出现分段错误。
I tried uninstalling NPM and nodejs using many variations of:我尝试使用以下多种变体卸载 NPM 和 nodejs:
sudo apt-get remove --purge npm
sudo apt-get remove --purge nodejs
sudo apt-get remove --purge node
And reinstalling them.并重新安装它们。
However, they never seem to uninstall.但是,它们似乎永远不会卸载。 Whenever I type NPM or node, it says permission denied.
每当我输入 NPM 或节点时,它都会说权限被拒绝。 When I use sudo, I get a segmentation fault.
当我使用 sudo 时,出现分段错误。
$ which npm
results in /usr/local/bin/npm
and I get similar results with nodejs. $ which npm
导致/usr/local/bin/npm
,我用 nodejs 得到类似的结果。
Is there a simple way to fix this?有没有简单的方法来解决这个问题? I'm very leery about manually removing packages.
我对手动删除软件包持怀疑态度。 I've tried this on a personal machine in the past and messed up the package manager so badly that I had no choice but to reinstall Ubuntu.
我过去曾在个人机器上尝试过此操作,并将 package 管理器搞砸了,以至于我别无选择,只能重新安装 Ubuntu。 I would like to avoid doing that since this is on a development server.
我想避免这样做,因为这是在开发服务器上。
The node binary was corrupt and Ubuntu was unable to unstall/uninstall node using the apt package manager.节点二进制文件已损坏,Ubuntu 无法使用 apt package 管理器卸载/卸载节点。 To solve this issue I just copied the node 12.13.0 binary file from another machine into /usr/local/bin on this machine.
为了解决这个问题,我只是将节点 12.13.0 二进制文件从另一台机器复制到这台机器上的 /usr/local/bin 中。 Now node and all node related modules (such as npm) work perfectly fine.
现在 node 和所有与 node 相关的模块(例如 npm)都可以正常工作。
i had same problem, and simply fix it by: apt update
then apt upgrade
- HOPE THIS HELP -我有同样的问题,只需通过以下方式修复它:
apt update
然后apt upgrade
- 希望有帮助 -
just remove nodejs, use只需删除 nodejs,使用
sudo apt-get remove nodejs
then go to /usr/local/bin and remove node, nodejs npm if exists:然后 go 到/usr/local/bin并删除节点,nodejs npm 如果存在:
sudo rm nodejs
sudo rm npm
sudo rm node
reinstall nodejs with this link https://computingforgeeks.com/install-latest-node-js-and-npm-on-ubuntu-debian/使用此链接重新安装 nodejs https://computingforgeeks.com/install-latest-node-js-and-npm-on-ubuntu-debian/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.