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 nodeWelcome 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# Execute a local binary$ 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
Examples (multiple versions)
# Run multiple versions$ nve 12,10,8 npm test ⬢ Node 12.22.12 105 tests passed Finished 'test' after 3.8 s ⬢ Node 10.24.1 105 tests passed Finished 'test' after 4.2 s ⬢ Node 8.17.0 105 tests passed Finished 'test' after 4.5 s# Do not abort on the first version that fails$ nve --continue 12,10,8 npm test# Run all versions in parallel
Examples (list versions)
# Prints latest Node.js version$ nve latest20.4.0# Prints latest Node.js 8 version$ nve 88.17.0# Prints latest Node.js 12, 10 and 8 versions$ nve 12,10,812.22.1210.24.18.17.0
Install
npm install -g nve
node >=18.18.0 must be globally installed. However the command run by nve
can use any Node version (providing it is compatible with it).
To use this programmatically (from Node.js) instead, please check
nvexeca.
Usage
nve [OPTIONS...] VERSION,... [COMMAND] [ARGS...]
This is exactly the same as:
COMMAND [ARGS...]
But using a specific Node VERSION. Several comma-separated VERSION can be
specified at once.
Base URL to retrieve Node binaries. Can be overridden (for example
https://npmmirror.com/mirrors/node).
The following environment variables can also be used: NODE_MIRROR,
NVM_NODEJS_ORG_MIRROR, N_NODE_MIRROR or NODIST_NODE_MIRROR.
--fetch
Alias: -f Type: boolean Default: undefined
The list of available Node.js versions is cached for one hour by default. With:
--fetch: the cache will not be used
--no-fetch: the cache will be used even if it's older than one hour
The default value is undefined (neither of the above). When no COMMAND is
specified (only printing the Node.js version), the default value is --fetch
instead.
Node.js binary's CPU architecture. This is useful for example when you're on x64
but would like to run Node.js x32.
All the values from
process.arch are
allowed except mips and mipsel.
Initial download
The first time nve is run with a new VERSION, the Node binary is downloaded
under the hood. This initially takes few seconds. However subsequent runs are
almost instantaneous.
COMMAND can be omitted in order to cache that initial download without
executing any commands.
Difference with nvm
nve is meant for one-off command execution. Examples include:
running tests with an older Node.js version
checking if an older Node.js version supports a specific syntax or feature