Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to install a specific version of Node on Ubuntu?

Tags:

node.js

ubuntu

n

I would like to install NodeJS version 0.8.18 on Ubuntu 12.04. I tried to install the newest version and then reverting to 0.8.18 by using nvm, but when I run my code apparently there is some problem with the packages installed and the two versions (latest and 0.8.18). Since I don't know how to solve that problem, I cleaned the machine from the Node installation and thought about installing directly the version I'm interested in (v0.8.18).

like image 695
Masiar Avatar asked Jun 03 '13 13:06

Masiar


People also ask

How do I install a specific version of node?

How To Install A Specific Version Of A Package. You can use the npm install command to download and install a package on your development environment. By default, the npm install command fetches the latest available version of the specified package—in this case, it's Renovate version 24.52.


2 Answers

The n module worked for me.

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

sudo npm cache clean -f sudo npm install -g n 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 what version:

node -v

You might need to restart

like image 76
Rimian Avatar answered Sep 28 '22 06:09

Rimian


Chris Lea has 0.8.23 in his ppa repo.

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

sudo apt-get install software-properties-common 

Add Chris Lea's 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 legacy and ppa/chris-lea/node.js you most likely need to add the version.

like image 21
Pickels Avatar answered Sep 28 '22 08:09

Pickels