Coder Perfect

How can I uninstall or upgrade my outdated version of Node.js?

Problem

I installed node.js on my Ubuntu system some time ago. with the following steps (history dump):

309  git clone git://github.com/joyent/node.git
310  cd node/
311  ./configure 
312  make
313  ls -l
314  node
315  sudo make install

v0.3.2-pre is the version I’m using.

Is there a clean way to receive a new version without having to remove, reinstall, or upgrade? I’m not too familiar with make or git.

Thanks

Asked by koalabruder

Solution #1

A node version manager is n. It takes care of everything for you. It either instals and switches to the version you choose, or it just switches if you already have it.

Note: Don’t use sudo if you’re having problems installing anything because of permissions. Once you’ve run this command, your user account will be the owner of the /usr/local/ directory, allowing you to run normal tasks without the need for sudo. It’s a more reasonable option.

sudo chown -R $USER /usr/local

Answered by generalhenry

Solution #2

Rep the procedure exactly as before. The new binary will be overwritten by the old.

The final step replaces what’s already there with what you’ve just created.

Answered by Dan Grossman

Solution #3

The most recent stable “LTS” version of node is 12.18.4 (2020-10-03), which can be found at nodejs.org.

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

Once you’ve installed NVM, you can use the nvm command to install a specific version of Node.js:

nvm install v12.18.4

Note that the nvm command may not be available until you close and reopen your terminal window.

In your terminal, you should expect to see something similar to this:

Now using node v12.18.4

Yes, it’s that simple, and it doesn’t even require sudo! Please vote this up (so that others don’t have to sudo-install things!) and have a great day coding in Node.js!

According to the node mailing list, the best approach to handle your nodejs versioning/upgrading is to use NVM (Node Version Manager). nvm-sh/nvm https://github.com/nvm-sh/nvm

Because the verbose commands make it much easier to keep track of what you’re doing in your Terminal/SSH Log, NVM is deemed “better” than N. It’s also faster, doesn’t require sudo, and is used by the team at NPM the node. Experts in JavaScript security!

Answered by nelsonic

Solution #4

On Ubuntu 12.04, this worked well for me: http://dev.squarecows.com/2012/06/28/nodejs-0-8-on-ubuntu-12-04/

add-apt-repository ppa:richarvey/nodejs
apt-get update
apt-get install nodejs npm

There’s no need to construct anything. This will be accomplished through the package manager.

Answered by odedfos

Solution #5

Nodist is the most user-friendly Node version manager for Windows.

nmvw, which requires Python 2.7 and git, is another option; I haven’t tried it.

Answered by iono

Post is based on https://stackoverflow.com/questions/5123533/how-can-i-uninstall-or-upgrade-my-old-node-js-version