← 全部工具

nve

热度 65 更新于 开发与构建

Run any command on specific Node.js versions

npmauto-collected

安装

npm
npm install -g nve

通过 npm 安装。

<picture <source media="(prefers-color-scheme: dark)" srcset="https://raw.githubusercontent.com/ehmicky/design/main/nve/nvedark.svg"/ <img alt="nve logo" src="https://raw.githubusercontent.com/ehmicky/design/main/nve/nve.svg" width="500"/ </picture

Run any command on specific Node.js versions.

Unlike nvm exec it:

  • can run multiple Node.js versions at once
  • can be run programmatically
  • is much faster
  • does not need a separate installation step for each Node version
  • can run the major release's latest minor/patch version automatically
  • works on Windows. No need to run as Administrator.
  • does not require Bash
  • is installed as a Node module (as opposed to a

Bash installation script downloaded with curl)

nve executes a single file or command. It does not change the node nor npm global binaries. To run a specific Node.js version for an entire project or shell session, please use nvm, nvm-windows, n or nvs instead.

Examples

# Same as `node` but with Node 12
$ nve 12 node
Welcome to Node.js v12.22.12.
Type ".help" for more information.
> .exit

# Same as `node file.js` but with Node 8
$ nve 8 node file.js

# Any command can be used
$ nve 12 npm test

$ nve 8 ava

Run a specific version

$ nve 8.10.0 npm test

Use a version range

$ nve "<8" npm test

Run the latest Node.js version

$ nve latest npm test

Run the latest LTS version

$ nve lts npm test