Node js delete linux

How to Clean uninstall nodejs / node on ubuntu 16.04

I had installed node and npm via : $sudo apt-get install npm then I realised the node version was 4.2.6, which I could not run my code ( some function syntax errors/ type erros etc.) So I set to uninstall nodejs: sudo apt-get remove npm sudo apt-get purge nodejs sudo apt-get autoremove rm -r /usr/local/bin/npm rm -rf ~/.npm rm -rf /opt/local/bin/node rm -rf opt/local/include/node rm -rf /opt/local/lib/node_modules Installing again with latest LTS, I am following install instructions from https://nodejs.org/en/download/package-manager/ curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash — sudo apt-get install -y nodejs My Question: After above install nodejs version is still 4.2.6, How can I get the latest version ? Or uninstall and clean the 4.2.6 ?

Use this command for uninstall and clean: sudo apt-get remove but this question stack overflow askubuntu.com/questions/1143/how-can-i-uninstall-software

This is specific to nodejs uninstall/install sudo apt-get install -y nodejs Reading package lists. Done Building dependency tree Reading state information. Done The following additional packages will be installed: libuv1 The following NEW packages will be installed: libuv1 nodejs 0 upgraded, 2 newly installed, 0 to remove and 203 not upgraded. Need to get 3,161 kB/3,218 kB of archives. After this operation, 13.4 MB of additional disk space will be used. Get:1 archive.ubuntu.com/ubuntu xenial-updates/universe amd64 nodejs amd64 4.2.6~dfsg-1ubuntu4.1 [3,161 kB]

@SamDev : this is very specific to nodejs and ubuntu and not «how to uninstall any package». I would appreciate if you can read the full question

Источник

How to remove nodejs from Ubuntu 16.04?

I want to uninstall nodejs and npm and have seen several posts which suggest this is the most common way:

sudo apt-get purge --auto-remove nodejs 

However, this produces a prompt which seems to reference dependencies which, if they were removed, sound like they would cause problems. What is the best way to «undo» the install of nodejs and npm ?

Reading package lists. Done Building dependency tree Reading state information. Done The following packages will be REMOVED: gyp* libboost-python1.58.0* libjs-inherits* libjs-node-uuid* libjs-underscore* libssl-dev* libssl-doc* libuv1* libuv1-dev* linux-headers-4.4.0-18* linux-headers-4.4.0-18-generic* linux-headers-4.4.0-21* linux-headers-4.4.0-21-generic* linux-image-4.4.0-18-generic* linux-image-4.4.0-21-generic* linux-image-extra-4.4.0-18-generic* linux-image-extra-4.4.0-21-generic* linux-signed-image-4.4.0-18-generic* linux-signed-image-4.4.0-21-generic* node-abbrev* node-ansi* node-ansi-color-table* node-archy* node-async* node-block-stream* node-combined-stream* node-cookie-jar* node-delayed-stream* node-forever-agent* node-form-data* node-fstream* node-fstream-ignore* node-github-url-from-git* node-glob* node-graceful-fs* node-gyp* node-inherits* node-ini* node-json-stringify-safe* node-lockfile* node-lru-cache* node-mime* node-minimatch* node-mkdirp* node-mute-stream* node-node-uuid* node-nopt* node-normalize-package-data* node-npmlog* node-once* node-osenv* node-qs* node-read* node-read-package-json* node-request* node-retry* node-rimraf* node-semver* node-sha* node-sigmund* node-slide* node-tar* node-tunnel-agent* node-underscore* node-which* nodejs* nodejs-dev* npm* python-configobj* python-pycurl* python-pyexiv2* python-pyexiv2-doc* 0 to upgrade, 0 to newly install, 72 to remove and 0 not to upgrade. After this operation, 631 MB disk space will be freed. Do you want to continue? [Y/n] 
Reading package lists. Done Building dependency tree Reading state information. Done The following packages were automatically installed and are no longer required: gyp libboost-python1.58.0 libjs-inherits libjs-node-uuid libjs-underscore libssl-dev libssl-doc libuv1 libuv1-dev linux-headers-4.4.0-18 linux-headers-4.4.0-18-generic linux-headers-4.4.0-21 linux-headers-4.4.0-21-generic linux-image-4.4.0-18-generic linux-image-4.4.0-21-generic linux-image-extra-4.4.0-18-generic linux-image-extra-4.4.0-21-generic linux-signed-image-4.4.0-18-generic linux-signed-image-4.4.0-21-generic python-configobj python-pycurl python-pyexiv2 python-pyexiv2-doc Use 'sudo apt autoremove' to remove them. The following packages will be REMOVED: node-abbrev* node-ansi* node-ansi-color-table* node-archy* node-async* node-block-stream* node-combined-stream* node-cookie-jar* node-delayed-stream* node-forever-agent* node-form-data* node-fstream* node-fstream-ignore* node-github-url-from-git* node-glob* node-graceful-fs* node-gyp* node-inherits* node-ini* node-json-stringify-safe* node-lockfile* node-lru-cache* node-mime* node-minimatch* node-mkdirp* node-mute-stream* node-node-uuid* node-nopt* node-normalize-package-data* node-npmlog* node-once* node-osenv* node-qs* node-read* node-read-package-json* node-request* node-retry* node-rimraf* node-semver* node-sha* node-sigmund* node-slide* node-tar* node-tunnel-agent* node-underscore* node-which* nodejs* nodejs-dev* npm* 0 to upgrade, 0 to newly install, 49 to remove and 0 not to upgrade. After this operation, 27.6 MB disk space will be freed. Do you want to continue? [Y/n] 

Источник

Читайте также:  Manjaro linux восстановить загрузчик

How can I completely uninstall nodejs, npm and node in Ubuntu [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.

This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.

The Question is similar to How do I completely uninstall Node.js, and reinstall from beginning (Mac OS X) but for Ubuntu, and just for uninstalling. Installation was done by: sudo apt-get install node How do I completely remove npm along with all libraries, packages and any other files installed by npm on my system, via e.g. npm install -g @vue/cli ? I do plan to reinstall npm afterwards.

installing nodejs-legacy works if you first apt-get remove node (or better yet, purge). The node program is a ham radio software modem so unless you have a ham license and want to send digital packets over ham radio you don’t need it.

yeah, I did it. Still I had problems. Everytime I wrote node in the console it would tell me something like /usr/sbin/ couldn’t finde node or something like that.

7 Answers 7

sudo apt-get remove nodejs sudo apt-get remove npm 

Then go to /etc/apt/sources.list.d and remove any node list if you have. Then do a

Check for any .npm or .node folder in your home folder and delete those.

you can see the location of the node. Try which nodejs and which npm too.

Читайте также:  Openvpn linux server config

I would recommend installing node using Node Version Manager(NVM). That saved a lot of headache for me. You can install nodejs and npm without sudo using nvm.

Adding to this, I will also suggest you to remove any 3rd part PPAs if you have added them. I was stuck at this problem, node was getting removed but still I was unable to install a newer version without using nvm

answer above assumes that this was not installed using the node script and wget. @zanna has name on both solutions, and the two should be combined

@LeeRuns I only edited them. I agree there is a lot of duplication on this post — I think three nearly identical answers have already been removed. I don’t think I can do anything further with the tools available to me.

It is better to remove NodeJS and its modules manually because installation leaves a lot of files, links and modules behind and later this creates problems when we reconfigure another version of NodeJS and its modules.

To remove the files, run the following commands:

sudo rm -rf /usr/local/bin/npm sudo rm -rf /usr/local/share/man/man1/node* sudo rm -rf /usr/local/lib/dtrace/node.d rm -rf ~/.npm rm -rf ~/.node-gyp sudo rm -rf /opt/local/bin/node sudo rm -rf /opt/local/include/node sudo rm -rf /opt/local/lib/node_modules sudo rm -rf /usr/local/lib/node* sudo rm -rf /usr/local/include/node* sudo rm -rf /usr/local/bin/node* 

Under what circumstances would a system-installed Node write things in /opt , let alone then /usr/local ?

Note: This will completely remove nodejs from your system; then you can make a fresh install from the below commands.

sudo apt-get remove nodejs npm node sudo apt-get purge nodejs 

Now remove .node and .npm folders from your system

sudo rm -rf /usr/local/bin/npm sudo rm -rf /usr/local/share/man/man1/node* sudo rm -rf /usr/local/lib/dtrace/node.d sudo rm -rf ~/.npm sudo rm -rf ~/.node-gyp sudo rm -rf /opt/local/bin/node sudo rm -rf opt/local/include/node sudo rm -rf /opt/local/lib/node_modules sudo rm -rf /usr/local/lib/node* sudo rm -rf /usr/local/include/node* sudo rm -rf /usr/local/bin/node* 

Go to home directory and remove any node or node_modules directory, if exists.

Читайте также:  Linux prolific usb to serial comm

You can verify your uninstallation by these commands; they should not output anything.

which node which nodejs which npm 

Installing NVM (Node Version Manager) by downloading and running a script

curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash 

The command above will clone the NVM repository from Github to the ~/.nvm directory:

Close and reopen your terminal to start using nvm or run the following to use it now:

export NVM_DIR="$HOME/.nvm" [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion 

As the output above says, you should either close and reopen the terminal or run the commands to add the path to nvm script to the current shell session. You can do whatever is easier for you.

Once the script is in your PATH, verify that nvm was properly installed by typing:

which should give this output:

Installing Node.js and npm

nvm install node nvm install --lts 

Once the installation is completed, verify it by printing the Node.js version:

Npm should also be installed with node, verify it using

Extra — [Optional] You can also use two different versions of node using nvm easily

nvm install 8.10.0 # just put the node version number Now switch between node versions

$ nvm ls -> v12.14.1 v13.7.0 default -> lts/* (-> v12.14.1) node -> stable (-> v13.7.0) (default) stable -> 13.7 (-> v13.7.0) (default) iojs -> N/A (default) unstable -> N/A (default) lts/* -> lts/erbium (-> v12.14.1) lts/argon -> v4.9.1 (-> N/A) lts/boron -> v6.17.1 (-> N/A) lts/carbon -> v8.17.0 (-> N/A) lts/dubnium -> v10.18.1 (-> N/A) 

In my case v12.14.1 and v13.7.0 both are installed, to switch I have to just use

Configuring npm for global installations In your home directory, create a directory for global installations:

Configure npm to use the new directory path:

npm config set prefix '~/.npm-global' 

In your preferred text editor, open or create a ~/.profile file if does not exist and add this line:

On the command line, update your system variables:

Источник

Оцените статью
Adblock
detector