Which versions of npm came with which versions of node? I can't find such a list.
Installing the previous version of Node.js and NPM: To install the previous versions from the latest version, the latest version of Node.js should be installed on your computer or you can install it from the official site of Node.js. Step 1: Check the installed version of Node and NPM on the computer use the following command respectively
To see if you already have Node.js and npm installed and check the installed version, run the following commands: Node version managers allow you to install and switch between multiple versions of Node.js and npm on your system so you can test your applications on multiple versions of npm to ensure they work for users on different versions.
However, npm is released more frequently than Node.js, so to install the latest stable version of npm, on the command line, run:
Node version managers allow you to install and switch between multiple versions of Node.js and npm on your system so you can test your applications on multiple versions of npm to ensure they work for users on different versions.
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/
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.
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" }, ... ]
As you can see it lists each version of nodejs and it's respective version of npm.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With