← 全部工具

ehmicky/get-node

热度 65 更新于 开发与构建

Download a specific version of Node.js

githubauto-collected

安装

暂未验证可直接使用的安装命令,请查看项目官方文档或 Release。

Download a specific version of Node.js.

The Node.js release is downloaded, uncompressed and untared to an executable file ready to run.

Features

Fast:

  • the download is cached
  • the best compression algorithm available on your machine is used
  • everything is streamed

Reliable:

  • the binary is checked against

official checksums

  • can be safely run concurrently
  • atomic writes

Features include:

  • Linux/Mac/Windows support
  • works with old Node.js versions
  • progress bar
  • using version ranges
  • specifying a mirror website for nodejs.org
  • helpful error messages
  • can guess the current project's version using its

.nvmrc or package.json (engines.node field)

Example

import getNode from 'get-node'

// Download a specific Node.js release
const { path, version } = await getNode('8')
console.log(path) // /home/user/.cache/nve/8.17.0/node
console.log(version) // 8.17.0
// Download Node.js latest release
const { path, version } = await getNode('latest')
console.log(path) // /home/user/.cache/nve/16.3.0/node
console.log(version) // 16.3.0
// Any version range can be used
await getNode('8.12.0')
await getNode('<7')
// Download latest LTS Node.js version
await getNode('lts')