Run any command on specific Node.js versions.
Unlike nvm exec
it:
curl
)nve
executes a single file or command. It does not change the node
nornpm
global binaries. To run a specific Node.js version for an entire projector shell session, please use nvm
,nvm-windows
,n
or nvs
instead.
# Same as `node` but with Node 12
$ nve 12 node
Welcome to Node.js v12.22.1.
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
$ nve latest npm test
# Run the latest LTS version
$ nve lts npm test
# Run the Node version from `~/.nvmrc` or the current process version
$ nve global npm test
# Run the current directory's Node.js version using its `.nvmrc` or `package.json` (`engines.node` field)
$ nve local npm test
# Use a different mirror for the Node binaries
$ nve --mirror=https://npm.taobao.org/mirrors/node 8 npm test
# Do not use the cached list of available Node.js versions
$ nve --fetch 8 npm test
# Always use the cached list of available Node.js versions even if it's more
# than one hour old
$ nve --no-fetch 8 npm test
# Use a different CPU architecture for the Node binaries
$ nve --arch=x32 8 npm test
# Chaining commands
$ nve 8 npm run build && nve 8 npm test
# Cache Node 8 download
$ nve 8 node --version
# Run multiple versions
$ nve 12,10,8 npm test
⬢ Node 12
105 tests passed
Finished 'test' after 3.8 s
⬢ Node 10
105 tests passed
Finished 'test' after 4.2 s
⬢ Node 8
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
$ nve --parallel 12,10,8 npm test
# Cache multiple Node downloads
$ nve 12,10,8 node --version
# Prints latest Node.js version
$ nve latest
16.3.0
# Prints latest Node.js 8 version
$ nve 8
8.17.0
# Prints latest Node.js 12, 10 and 8 versions
$ nve 12,10,8
12.22.1
10.24.1
8.17.0
You can try this library:
examples
files in a terminal.npm install -g nve
node >=12.20.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 checknvexeca
.
nve [OPTIONS...] VERSION,... [COMMAND] [ARGS...]
This is exactly the same as:
COMMAND [ARGS...]
But using a specific Node VERSION
. Several comma-separated VERSION
can bespecified at once.
VERSION
can be any version range such as12
, 12.6.0
or <12
, or one of the following aliases:
latest
: Latest available Node versionlts
: Latest LTS Node versionglobal
: Global Node version
.nvmrc
orpackage.json
(engines.node
field)local
: Current directory's Node version
.nvmrc
,package.json
(engines.node
field)(oradditional files)global
versionCOMMAND
must be compatible with the specific Node VERSION
. For example npm
is only compatible with Node >=6
.
Both global and local binaries can be executed.
Alias: -c
Type: boolean
Default: false
By default, when running multiple Node versions and one of those versions fails,the others are aborted. This option disables this.
Alias: -p
Type: boolean
Default: false
When running multiple Node versions, run all of them at the same time. This isfaster. However this does not work if the command:
Type: boolean
Default: true
Whether to show a progress bar while the Node binary is downloading.
Alias: -m
Type: string
Default: https://nodejs.org/dist
Base URL to retrieve Node binaries. Can be overridden (for examplehttps://npm.taobao.org/mirrors/node
).
The following environment variables can also be used: NODE_MIRROR
,NVM_NODEJS_ORG_MIRROR
, N_NODE_MIRROR
or NODIST_NODE_MIRROR
.
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 hourThe default value is undefined
(neither of the above). When no COMMAND
isspecified (only printing the Node.js version), the default value is --fetch
instead.
Alias: -a
Type: string
Default:process.arch
Node.js binary's CPU architecture. This is useful for example when you're on x64but would like to run Node.js x32.
All the values fromprocess.arch
areallowed except mips
and mipsel
.
The first time nve
is run with a new VERSION
, the Node binary is downloadedunder the hood. This initially takes few seconds. However subsequent runs arealmost instantaneous.
COMMAND
can be omitted in order to cache that initial download withoutexecuting any commands.
nve
is meant for one-off command execution. Examples include:
Tools like nvm
,nvm-windows
,n
or nvs
aremeant to execute a specific Node.js version for an entire machine, project orshell session.
nve
can (and probably should) be used alongside those tools.
If your code is using native modules, nve
works providing:
>=8.12.0
(since N-API was not available orstable before that)Otherwise the following error message is shown:Error: The module was compiled against a different Node.js version
.
The following benchmarks compare the average time to runnve
, nvm exec
andnpx node
:
nve: 286ms
nvm exec: 580ms
npx node: 861ms
nvexeca
: Like nve
but programmatic(from Node.js)execa
: Process execution for humansget-node
: Download Node.jspreferred-node-version
:Get the preferred Node.js version of a project or usernode-version-alias
: ResolveNode.js version aliases like latest
, lts
or erbium
normalize-node-version
:Normalize and validate Node.js versionsall-node-versions
: List allavailable Node.js versionsfetch-node-website
: Fetchreleases on nodejs.orgglobal-cache-dir
: Get theglobal cache directoryFor any question, don't hesitate to submit an issue on GitHub.
Everyone is welcome regardless of personal background. We enforce aCode of conduct in order to promote a positive andinclusive environment.
This project was made with
If the documentation is unclear or has a typo, please click on the page's Edit
button (pencil icon) and suggest a correction.
If you would like to help us fix a bug or add a new feature, please check ourguidelines. Pull requests are welcome!
Thanks go to our wonderful contributors:
![]() ehmicky |
![]() Scott Warren |
![]() Charlike Mike Reagent |
![]() Hongarc |
![]() Pedro Augusto de Paula Barbosa |
![]() Adrien Becchis |
了解lammps中NVE/NVT/NPT三种系综的特性和区别: 系综是lammps模拟中的一个重要环节,系综种类及对应参数选择的直接决定了模拟结果程度的好坏。然而,由于各种体系、特定条件、系综种类和参数多且复杂,这就使得选择合适的系综及参数对于初学者而言并不是轻松的事。 针对这个问题,青山特意系统的介绍了三种常见的系综属性及它们之间的区别,帮助lammps初学者对此不再困惑。 系综: 首先要了解系
最近QQ群里有部分小伙伴,问我关于命令和系综的事情,对命令和系综的理解没有到应有的地步,我记得之前在口说LAMMPS命令系列教程(优酷有视频可免费观看)中强调过此事。下面再说一遍。 首先要声明的是,或者要强调的是:命令和系综没有直接联系,除非你的in文件里只有一个和系综相关的fix. 我们知道,按统计物理的概念来讲,我们常用的模拟系综分NVE(表示系统粒子数、体积、总能量保持不变,是为微正则系综)
虫食算 传染病控制 棋盘染色 水叮当的舞步 四子连棋 解药?毒药? 太鼓达人 单词接龙 四色问题 以及黄金天梯和CODEVS搜索第一页…..的大部分题…能做一点是一点吧。 听说打好搜索…NOIp问题不大,所以要自虐… 天哪… 稍微总结出了一点小小的规律? DFS:各种可行性剪枝,最优性剪枝,还有边界条件… BFS:一些恶心的判重…用hash或者进制优化?注意不要爆队列。有时候人工队列会比STL队列