从 /usr/local/bin/node 卸载节点

Uninstall node from /usr/local/bin/node

我在卸载包 node 时遇到问题,它甚至不存在但仍然出现在路径中,这很奇怪,或者我是傻子... 它与 nodejs 相矛盾,我想摆脱它并安装一个新的 node 符号链接到 nodejs 所以我有一个单一的事实来源。 到目前为止,我已经尝试了大多数流行的包管理器。

#tag node vs nodejs linux

durrani@ideapad:~ $ nodejs --version
Command 'nodejs' not found, but can be installed with:
sudo apt install nodejs

durrani@ideapad:~ $ node --version
v12.14.0
durrani@ideapad:~ $ which nodejs
durrani@ideapad:~ $ which node   
/usr/local/bin/node
durrani@ideapad:~ $ type node
node is hashed (/usr/local/bin/node)
durrani@ideapad:~ $ type nodejs
bash: type: nodejs: not found
durrani@ideapad:~ $ sudo apt-get remove node
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package node
durrani@ideapad:~ $ sudo apt-get purge node
Reading package lists... Done
Building dependency tree       
Reading state information... Done
E: Unable to locate package node
durrani@ideapad:~ $ sudo snap remove node
snap "node" is not installed
durrani@ideapad:~ $ sudo pkcon remove node
Resolving                     [=========================]         Package not found: node
Command failed: This tool could not find the installed package: No packages were found

和 运行 那里得到了一些帮助:

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

然后我按照Node.js website -> instructions

上的官方方法安装了nodejs

长话短说;博士 运行 以下内容:
12.16.2 是今天的 LTS 版本。

curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
sudo apt-get install -y nodejs

我得到的最终结果:

durrani@ideapad:~ $ node --version
v12.16.2
durrani@ideapad:~ $ nodejs --version
v12.16.2
durrani@ideapad:~ $ which node
/usr/bin/node
durrani@ideapad:~ $ which nodejs
/usr/bin/nodejs