[英]Which versions of npm came with which versions of node?
Which versions of npm came with which versions of node?哪些版本的 npm 附带哪些版本的 node? I can't find such a list.
我找不到这样的清单。
At https://nodejs.org/dist/ there is index.json which indicates each version of nodejs and which version of npm is bundled with it.在https://nodejs.org/dist/ 上有index.json ,它指示 nodejs 的每个版本以及与其捆绑的 npm 版本。
index.json索引文件
An excerpt from one of the objects in the array of index.json
reads: index.json
数组中的一个对象摘录如下:
[
{
"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
(ie the nodejs version) and npm
(ie the npm version) key/value pair.因此数组中的每个对象都有一个
version
(即 nodejs 版本)和npm
(即 npm 版本)键/值对。
Consider utilizing the following node.js script to request the data from the https://nodejs.org/dist/index.json
endpoint.考虑使用以下 node.js 脚本从
https://nodejs.org/dist/index.json
端点请求数据。
get-versions.js获取-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.如您所见,它列出了 nodejs 的每个版本及其各自的 npm 版本。
here is the list :这是清单:
Node >> 10.6.0 npm >> 6.1.0节点 >> 10.6.0 npm >> 6.1.0
node >> 9.0.0 npm >> 5.5.1节点 >> 9.0.0 npm >> 5.5.1
https://nodejs.org/en/download/releases/ https://nodejs.org/en/download/releases/
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.