Many times we have some dependency which forces us to use some specific Node.js version. Specific Node.js version can be installed as below:
Step#1
- clear the cache by sing following command
$ sudo npm cache clean -f
Step#2
- Use following command to install node globally and specify the required version.
$ sudo npm install -g n
$ sudo n 6.9.5
You will receive following confirmation of Node.js installation:
User@hostname:~$ sudo n 6.9.5
install : node-v6.9.5
mkdir : /usr/local/n/versions/node/6.9.5
fetch : https://nodejs.org/dist/v6.9.5/node-v6.9.5-linux-x64.tar.gz
######################################################################## 100.0%
installed : v6.9.5
Alternatively, you can download required Node.js version from Node.js repository http://nodejs.org/dist/
Use following command to download required version file.
$ wget nodejs.org/dist/v0.10.36/node-v0.10.36-linux-x64.tar.gz
Same package can be downloaded without command line utility as well. install the this compressed file to get your required Node.js version.