Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I uninstall or upgrade my old node.js version?

Tags:

linux

node.js

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

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 

My Version is v0.3.2-pre.

Please, is there a clean way to get a new version by uninstall/install or upgrade? I have not much experience with make or git.

Thanks

like image 603
koalabruder Avatar asked Feb 25 '11 22:02

koalabruder


People also ask

How do I uninstall an existing version of node JS?

Search for Program and features. Under the program and features click on Uninstall a program. Now search for Node. js and uninstall it.


2 Answers

  1. Install npm using curl (or wget)
    curl http://npmjs.org/install.sh | sh
  2. Install n using npm
    npm install -g n
  3. Install the latest version of node using n
    n latest

n is a node version manager. It does all the work for you. It installs and switches to the version you specify, or just switches if you already have it installed.

Note: If you're having trouble installing stuff due to permissions, don't use sudo. Enter this command once to set your user account as the owner of the /usr/local/ directory, so that you can just issue normal commands in there without sudo. It's a more sane alternative.

sudo chown -R $USER /usr/local 
like image 173
generalhenry Avatar answered Sep 17 '22 08:09

generalhenry


Do the exact same thing again. The new binary will be copied over the old one.

  • git clone creates a copy of git repository node's source code is in
  • cd node/ changes directory to the one you just created with those files
  • ./configure checks for dependencies and creates a makefile
  • make executes that makefile, which results in compiling the source code into binary executable(s), libraries and any other outputs
  • ls -l lists the files in the current directory
  • node runs the node binary executable you just compiled from source, to ensure the compilation was successful
  • sudo make install copies the files you just created from the current directory to their permanent homes, /usr/local/bin and such

The last step overwrites whatever's already there with what you just built.

like image 38
Dan Grossman Avatar answered Sep 17 '22 08:09

Dan Grossman