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')