简体   繁体   English

每当我尝试使用 NPM 或 nodejs 时,都会出现分段错误。 卸载并重新安装并不能解决它

[英]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.

相关问题 部分 API 在 NodeJS 中不起作用。 我如何解决它? - Part of the API is not working in NodeJS. How do I fix it? 无法安装最新版本的 nodejs。 我尝试安装 nodejs 17.x - Unable to install latest version of nodejs. I try to install nodejs 17.x 的NodeJS。 我可以在一个地方处理错误吗? 没有尝试抓住块 - NodeJS. Can I handle errors in one place? Without try and catch blocks 每当我尝试在 Visual Studio 代码上运行“npm install”时出现错误 - I get an error whenever i try to run "npm install" on visual studio code 每当我尝试安装 npm 软件包时,这些 WARN 消息都会出现 - Whenever I try to install npm packages these WARN messages show up 如何使用 nodejs 在 mysql 数据库中插入 npm uniqid 模块。 当我输入代码时,它显示错误“TypeError: uniqid is not a function” - How to insert npm uniqid modules in mysql database using nodejs. when i put on my code it display an error "TypeError: uniqid is not a function" 在NodeJ中。 为什么我以错误的格式从mongodb.ObjectID获取值 - In NodeJs. Why do I get the value from mongodb.ObjectID in the wrong format 如何修复Bower分段错误-Windows上的Eclipse? - How do I fix Bower segmentation fault - Eclipse on Windows? 节点。 安装 npm 后找不到 gulp - Nodejs. gulp not found after npm install “重新安装 nodejs 后出现错误” - “I got an error after reinstalling nodejs”
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM