简体   繁体   English

卸载从二进制分发文件安装的nodejs

[英]Uninstall nodejs installed from binary distribution files

I have installed nodejs(node-v4.2.1) in ubuntu 14.04 using zip file(tar.gz) downloaded from node js website(not using apt-get install.The location of installed node is /usr/local/bin . 我已经使用从node js网站下载的zip文件(tar.gz)在ubuntu 14.04中安装了nodejs(node-v4.2.1)(未使用apt-get install.installed的位置是/ usr / local / bin

while trying to uninstall it using sudo apt-get purge ,sudo apt-get remove &sudo apt-get autoremove is not working .How could I uninstall it? 在尝试使用sudo apt-get purge进行卸载时,sudo apt-get remove和sudo apt-get autoremove 无法正常工作。如何卸载?

I got the solution from the links given below 我从下面给出的链接中获得了解决方案

http://hungred.com/how-to/completely-removing-nodejs-npm/ http://hungred.com/how-to/completely-removing-nodejs-npm/

How to install node binary distribution files on Linux 如何在Linux上安装节点二进制分发文件

I did the following steps and it works fine


sudo rm -rf /usr/local/bin/npm
sudo rm -rf /usr/local/bin/node
sudo rm -rf /usr/local/lib/node_modules/
sudo rm -rf /usr/local/include/node/
sudo rm -rf /usr/local/share/man/man1/node.1



cd /home/userName
ls -ld .?* (to display hidden files)
# delete files/folders related with node
sudo rm -f .node_repl_history
sudo rm -rf .npm

To Re-install new version follow the below steps 要重新安装新版本,请按照以下步骤操作

1.Download new version from Node official website.In my case my downloaded file is node-v6.9.4-linux-x64.tar.xz 1.从Node官方网站下载新版本,我的下载文件是node-v6.9.4-linux-x64.tar.xz

2.Move the file into /usr/local directory using the command 2.使用命令将文件移动到/ usr / local目录

sudo mv  Downloads/node-v6.9.4-linux-x64.tar.xz /usr/local

3.Use the below command to extract into appropriate directories in /usr/local 3.使用以下命令将其解压缩到/ usr / local中的适当目录中

sudo tar --strip-components 1 -xf node-v6.9.4-linux-x64.tar.xz

-xf is to unzip .tar.xz for tar.gz use -xzf -xf将.tar.xz解压缩为tar.gz使用-xzf

4.verify installation 4.验证安装

node --version

检查zip中是否有卸载脚本,否则您需要为与节点相关的任何人工操作手动清理/usr/local

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM