Installing a specific version of Node on Ubuntu

I would like to install NodeJS version 0.8.18 on Ubuntu 12.04. I tried installing the latest version and then reverting to 0.8.18 using nvm , but when I run my code, there seems to be some problem with the installed packages and two versions (latest and 0.8.18). Since I do not know how to solve this problem, I cleared the machine from installing Node and thought about installing the version that interests me directly (v0.8.18). Unfortunately, I do not know how to do this. Can someone help me? Google was not my friend this time.

thank

+56
Jun 03 '13 at 13:32
source share
11 answers

Chris Lee has 0.8.23 in his ppa repo.

This package allows you to add a repository to apt-get: (You can also do this manually)

 sudo apt-get install software-properties-common 

Add Chris Lea Repository:

 sudo apt-add-repository ppa:chris-lea/node.js-legacy 

Update apt-get:

 sudo apt-get update 

Install Node.js:

 sudo apt-get install nodejs=0.8.23-1chl1~precise1 

I think (feel free to edit) the version number is optional if you only add Node.js-legacy. If you add both obsolete and ppa / chris-lea / node.js, you will most likely have to add a version.

+36
Jun 03 '13 at 17:23
source share

You can install a specific version of nodejs from the official nodejs distribution using dpkg .

For example, the latest version 4.x is currently 4.2.4, but you can install the previous version 4.2.3.

 curl -s -O https://deb.nodesource.com/node_4.x/pool/main/n/nodejs/nodejs_4.2.3-1nodesource1~trusty1_amd64.deb sudo apt-get install rlwrap sudo dpkg -i nodejs_4.2.3-1nodesource1~trusty1_amd64.deb 
+35
Dec 31 '15 at 2:09
source share

Module n worked for me.

Run this code to clear the npms cache, install n, and install the latest stable version of Node:

 sudo npm cache clean -f sudo npm install -gn sudo n stable 

See: http://www.hostingadvice.com/how-to/update-node-js-latest-version/
And: https://www.npmjs.com/package/n

To install a specific version of Node:

sudo n 6.11.2

To check which version:

node -v

You may need to restart

+34
Aug 17 '17 at 3:16 on
source share

Try this way. It worked.

  • wget nodejs.org/dist/v0.10.36/ node-v0.10.36-linux-x64.tar.gz (download file)

  • Change to the directory where the Node.js binary was downloaded, and then run ie, sudo tar -C / usr / local --strip-components 1 -xzf node -v0.10.36-linux-x64.tar.gz , to install the Node.js binary package in "/ usr / local /".

  • You can check: -

     $ node -v v0.10.36 $ npm -v 1.4.28 
+9
Aug 27 '15 at 9:53 on
source share

NVM (Node Version Manager)

Tested on Ubuntu 17.10:

 curl https://raw.githubusercontent.com/creationix/nvm/master/install.sh | sh source ~/.nvm/nvm.sh nvm install 0.9.0 nvm install 0.9.9 nvm use 0.9.0 node --version #v0.9.0 nvm use 0.9.9 node --version #v0.9.9 

For a specific case of the latest version of long-term support (recommended if you can choose):

 nvm install --lts nvm use --lts npm --version npm install --global vaca vaca 

Since you need to find a source for each new shell, you probably want to add the following to your .bashrc :

 f="$HOME/.nvm/nvm.sh" if [ -r "$f" ]; then . "$f" &>'/dev/null' nvm use --lts &>'/dev/null' fi 

Benefits:

  • allows you to use multiple versions of Node without sudo

  • similar to Ruby RVM and Python Virtualenv, which is considered best practice in the Ruby and Python communities.

  • loads a precompiled binary if possible, and if it does not load the source and compiles it for you

+7
Nov 19 '17 at 11:50
source share

version 0.10 is also available with this ppa

 apt-add-repository ppa:chris-lea/node.js 

install nodejs with:

 apt-get install nodejs=0.10.25-1chl1~precise1 

Thanks to my friend Julian Xhokaxhiu

+5
Feb 01 '14 at 16:36
source share

NOTE. You can use NVM software for this in a narrower modem. However, I got problems on one machine that prevented me from using NVM. So I need to look for an alternative; -)

You can download and install it manually.

go to nodejs> download> other releases http://nodejs.org/dist/

select the version you are looking for http://nodejs.org/dist/v0.8.18/

select the distribution files appropriate for your environment and download (take care of the 32-bit / 64-bit version). Example: http://nodejs.org/dist/v0.8.18/node-v0.8.18-linux-x64.tar.gz

Extract the files and follow the instructions on README.md:

To build:

Prerequisites (Unix only):

 * Python 2.6 or 2.7 * GNU Make 3.81 or newer * libexecinfo (FreeBSD and OpenBSD only) 

Unix / Macintosh:

 ./configure make make install 

If your python binary is in a non-standard location or has a non-standard name, do the following instead:

 export PYTHON=/path/to/python $PYTHON ./configure make make install 

Window:

 vcbuild.bat 

To run the tests:

Unix / Macintosh:

 make test 

Window:

 vcbuild.bat test 

To create documentation:

 make doc 

To read the documentation:

 man doc/node.1 

You might want (to) move the folder to a more appropriate location, for example / usr / lib / nodejs / node-v0.8.18 /, then create a Symbolic Lynk in / usr / bin to access your install from anywhere.

 sudo mv /extracted/folder/node-v0.8.18 /usr/lib/nodejs/node-v0.8.18 sudo ln -s /usr/lib/nodejs/node-v0.8.18/bin/node /usr/bin/node 

And if you want a different release on the same computer, you can use debian alternatives. Continue as before to download the second issue. For example, the latest version.

http://nodejs.org/dist/latest/ โ†’ http://nodejs.org/dist/latest/node-v0.10.28-linux-x64.tar.gz

Move to your favorite destination, the same from the rest of the release that you want to install.

 sudo mv /extracted/folder/node-v0.10.28 /usr/lib/nodejs/node-v0.10.28 

Follow the instructions in the README.md file. Then update the alternatives, for each version you have dowload to install the alternative.

 sudo update-alternatives --install genname symlink altern priority [--slave genname symlink altern] Add a group of alternatives to the system. genname is the generic name for the master link, symlink is the name of its symlink in the alternatives directory, and altern is the alternative being introduced for the master link. The arguments after --slave are the generic name, symlink name in the alternatives directory and alternative for a slave link. Zero or more --slave options, each followed by three arguments, may be specified. If the master symlink specified exists already in the alternatives system's records, the information supplied will be added as a new set of alternatives for the group. Otherwise, a new group, set to automatic mode, will be added with this information. If the group is in automatic mode, and the newly added alternatives' priority is higher than any other installed alternatives for this group, the symlinks will be updated to point to the newly added alternatives. 

eg:

 sudo update-alternatives --install /usr/bin/node node /usr/lib/nodejs/node-v0.10.28 0 --slave /usr/share/man/man1/node.1.gz node.1.gz /usr/lib/nodejs/node-v0.10.28/share/man/man1/node.1 

Then you can use update-alternatives --config node to select any number of editions installed on your computer.

+3
May 12 '14 at 10:54
source share

FYI, according to this page on the nodejs github repo wiki, Chris Lea PPA (mentioned in several other answers) has been replaced with NodeSource distributions as the main way to install nodejs from source in Ubuntu:

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

This is supported for the last three (at the time of writing this) LTS versions of Ubuntu: 10.04 (lucid), 12.04 LTS (accurate) and 14.04 (reliable).

I'm not sure if this helps in installing the old version of nodejs, but I put it here if it helps others who need to install a specific (newer) version of nodejs that is not included in their registry repositories.

+3
Sep 19 '14 at 15:08
source share

FYI available version for raring in Chris Lea repo currently 0.8.25

sudo apt-get install nodejs=0.8.25-2chl1~raring1

+2
Sep 11 '13 at 13:30
source share

yes, its a duplicate answer, but I insist on using the n module to install a specific version (the following commands install node version 6.9.5).

 npm install -gn n 6.9.5 
+1
Oct 03 '17 at 23:41
source share

Recently, the Node.js project has pushed a new stable version with the release of 0.10.0 Use the following command for Ubuntu 13x sudo apt-get install nodejs = 0.10.18-1chl1 ~ raring1

0
Sep 14 '13 at 19:18
source share



All Articles