D
D
dev-sasha2020-10-23 15:54:35
Node.js
dev-sasha, 2020-10-23 15:54:35

How to uninstall node.js in Ubuntu Linux?

I have Ubuntu 20.04 and NodeJS 14.xx on my dev computer.
I decided to upgrade to NodeJS 15.xx (it has already become available the other day, this is not an LTS version).

In the world of JavaScript, I can say a beginner.
There is an unpleasant "feeling" that I'm doing something wrong: I did the

installation of NodeJS 14 according to the instructions from the official site:

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


In order to upgrade to the 15th version, I decided to remove the 14th version first:
sudo apt remove nodejs

As a result of the command, I received the following warnings:
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following package was automatically installed and is no longer required:
  libutempter0
Use 'sudo apt autoremove' to remove it.
The following packages will be REMOVED:
  nodejs
0 upgraded, 0 newly installed, 1 to remove and 0 not upgraded.
After this operation, 120 MB disk space will be freed.
Do you want to continue? [Y/n] y
(Reading database ... 225795 files and directories currently installed.)
Removing nodejs (14.14.0-deb-1nodesource1) ...
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_modules/gentle-fs' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_modules/cliui/node_modules/strip-ansi' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_modules/cliui/node_modules/ansi-regex' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_modules/cliui/node_modules/string-width' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/cliui/node_modules/is-fullwidth-code-point' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/require-main-filename' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/minimist' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/libnpx' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/configstore' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/get-caller-file' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/wrap-ansi/node_modules/strip-ansi' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/wrap-ansi/node_modules/ansi-regex' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/wrap-ansi/node_modules/string-width' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/wrap-ansi/node_modules/is-fullwidth-code-point' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/dot-prop' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/bin-links' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/yargs/node_modules/strip-ansi' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/yargs/node_modules/ansi-regex' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/yargs/node_modules/locate-path' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/yargs/node_modules/p-try' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/yargs/node_modules/p-locate' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/yargs/node_modules/find-up' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/yargs/node_modules/string-width' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/yargs/node_modules/is-fullwidth-code-point' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/yargs/node_modules/p-limit' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/meant' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/yargs-parser/node_modules/camelcase' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/npm-registry-fetch' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/emoji-regex' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/npm-lifecycle' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/npm-audit-report' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/node_
modules/libcipm' not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/docs'
 not empty so not removed
dpkg: warning: while removing nodejs, directory '/usr/lib/node_modules/npm/lib' 
not empty so not removed
Processing triggers for man-db (2.9.1-1) ...


NodeJs has retired. NPM was also removed (judging by the result of the commands: which nodejs which npm)
At the same time, the directory with the files remained:
ls /usr/lib/node_modules/npm
CHANGELOG.md  changelogs  CONTRIBUTING.md  docs  lib  LICENSE  node_modules  npmrc  README.md


Question: What is the right way to remove (and/or upgrade to a new version) NodeJS ?
Thank you!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
I
Ivan Shumov, 2020-10-23
@dev-sasha

NVM

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question