Factsheet
How to change to an older version of Node.js - Stack Overflow
node.js - How do I find the old version of node js? - Stack Overflow
node.js - nvm ls does not list specific installed version numbers - Stack Overflow
node.js - Which versions of npm came with which versions of node? - Stack Overflow
» npm install node
*NIX (Linux, OS X, ...)
Use n, an extremely simple Node version manager that can be installed via npm.
Say you want Node.js v0.10.x to build Atom.
npm install -g n # Install n globally
n 0.10.33 # Install and use v0.10.33
Usage:
n # Output versions installed
n latest # Install or activate the latest node release
n stable # Install or activate the latest stable node release
n <version> # Install node <version>
n use <version> [args ...] # Execute node <version> with [args ...]
n bin <version> # Output bin path for <version>
n rm <version ...> # Remove the given version(s)
n --latest # Output the latest node version available
n --stable # Output the latest stable node version available
n ls # Output the versions of node available
Windows
Use nvm-windows, it's like nvm but for Windows. Download and run the installer, then:
nvm install v0.10.33 # Install v0.10.33
nvm use v0.10.33 # Use v0.10.33
Usage:
nvm install [version] # Download and install [version]
nvm uninstall [version] # Uninstall [version]
nvm use [version] # Switch to use [version]
nvm list # List installed versions
One way is to use NVM, the Node Version Manager.
Use following command to get nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.34.0/install.sh | bash
You can find it at https://github.com/creationix/nvm
It allows you to easily install and manage multiple versions of node. Here's a snippet from the help:
Usage:
nvm install <version> Download and install a <version>
nvm use <version> Modify PATH to use <version>
nvm ls List versions (installed versions are blue)
Easiest solution would be to try the following to cleanup your node issues and reinstall a clean version.
First remove everything related to node
sudo apt-get purge --auto-remove nodejs npm
UPDATE For yum:
yum clean all
yum -y remove nodejs
Remove these leftover files and folders as well
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules
Then install node back with nvm,
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.6/install.sh | bash
//To uninstall a node version
//nvm uninstall <current version>
nvm install 8.8.1
nvm use 8.8.1
//check with
node -v
npm -v
//**UPDATE**: Install your package
npm install -g n
And all should work.
UPDATE : Install Without NVM
yum install -y gcc-c++ make
curl -sL https://rpm.nodesource.com/setup_8.x | sudo -E bash -
yum install nodejs
node -v
//Install your package
npm install -g n
check the releases notes of node https://nodejs.org/en/download/releases/ you can download older version from this site
nvm list
This command worked fine for me. It will list all the installed versions of node under nvm
This happens when you have installed node but not installed using nvm, you can install the versions again, by like
nvm install 12.14 where 12.14 is that particular version you wanna use.
and use it by nvm use 12.14.
I read somewhere that you can actually have those versions being managed by nvm itself, but I need to find it again, will update my answer when I find it.
At https://nodejs.org/dist/ there is index.json which indicates each version of nodejs and which version of npm is bundled with it.
index.json
An excerpt from one of the objects in the array of index.json reads:
[
{
"version": "v10.6.0", //<--- nodejs version
"date": "2018-07-04",
"files": [
...
],
"npm": "6.1.0", //<--- npm version
"v8": "6.7.288.46",
"uv": "",
"zlib": "1.2.11",
"openssl": "1.1.0h",
"modules": "64",
"lts": false
},
...
]
Whereby each object in the array has a version (i.e. the nodejs version) and npm (i.e. the npm version) key/value pair.
Programmatically obtaining the versions
In-browser Snippet
(async function logVersionInfo() {
try {
const json = await requestVersionInfo();
const versionInfo = extractVersionInfo(json);
createVersionTable(versionInfo);
}
catch ({ message }) {
console.error(message);
}
})();
// Promise-wrapped XHR from @SomeKittens' answer:
// https://stackoverflow.com/a/30008115
function requestVersionInfo() {
return new Promise(function(resolve, reject) {
let xhr = new XMLHttpRequest();
xhr.open('GET', 'https://nodejs.org/dist/index.json');
xhr.onload = function() {
if (this.status >= 200 && this.status < 300) {
resolve(xhr.response);
} else {
reject({
status: this.status,
statusText: xhr.statusText
});
}
};
xhr.onerror = function() {
reject({
status: this.status,
statusText: xhr.statusText
});
};
xhr.send();
});
}
function extractVersionInfo(json) {
return JSON.parse(json).map(({ version, npm = '-' }) =>
({ nodejs: version.replace(/^v/, ''), npm })
);
}
function createVersionTable(array) {
const table = document.createElement("table");
table.border = 1;
const headerRow = document.createElement('tr');
for (const headerText of Object.keys(array[0])) {
const headerCell = document.createElement('th');
headerCell.textContent = headerText;
headerRow.appendChild(headerCell);
}
table.appendChild(headerRow);
for (const el of array) {
const tr = document.createElement("tr");
for (const value of Object.values(el)) {
const td = document.createElement("td");
td.textContent = value;
tr.appendChild(td);
}
table.appendChild(tr);
}
document.body.appendChild(table);
}
td { padding: 0 0.4rem; } tr:nth-child(even) td { background-color: antiquewhite; }
Node.js Script
Consider utilizing the following node.js script to request the data from the https://nodejs.org/dist/index.json endpoint.
get-versions.js
const { get } = require('https');
const ENDPOINT = 'https://nodejs.org/dist/index.json';
function requestVersionInfo(url) {
return new Promise((resolve, reject) => {
get(url, response => {
let data = '';
response.on('data', chunk => data += chunk);
response.on('end', () => resolve(data));
}).on('error', error => reject(new Error(error)));
});
}
function extractVersionInfo(json) {
return JSON.parse(json).map(({ version, npm = null }) => {
return {
nodejs: version.replace(/^v/, ''),
npm
};
});
}
(async function logVersionInfo() {
try {
const json = await requestVersionInfo(ENDPOINT);
const versionInfo = extractVersionInfo(json);
console.log(JSON.stringify(versionInfo, null, 2));
} catch ({ message }) {
console.error(message);
}
})();
Running the following command:
node ./path/to/get-versions.js
Will print something like the following to your console:
[ { "nodejs": "14.2.0", "npm": "6.14.4" }, { "nodejs": "14.1.0", "npm": "6.14.4" }, { "nodejs": "14.0.0", "npm": "6.14.4" }, { "nodejs": "13.14.0", "npm": "6.14.4" }, ... ]
It lists each version of Node.js and its respective NPM version.
here is the list :
Node >> 10.6.0 npm >> 6.1.0
node >> 9.0.0 npm >> 5.5.1
https://nodejs.org/en/download/releases/
» npm install all-node-versions