Gathering detailed insights and metrics for nvexeca
Gathering detailed insights and metrics for nvexeca
Gathering detailed insights and metrics for nvexeca
Gathering detailed insights and metrics for nvexeca
npm install nvexeca
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
42 Stars
983 Commits
5 Forks
3 Watching
1 Branches
1 Contributors
Updated on 27 Nov 2024
JavaScript (49.98%)
Shell (24.74%)
PowerShell (10.12%)
Batchfile (9.58%)
TypeScript (5.58%)
Cumulative downloads
Total Downloads
Last day
77.8%
553
Compared to previous day
Last week
-4.4%
3,087
Compared to previous week
Last month
15.1%
12,258
Compared to previous month
Last year
29.6%
153,653
Compared to previous year
nvm + execa = nvexeca.
Execa improves child processes execution with a promise interface, cross-platform support, local binaries, interleaved output, and more.
nvexeca is a thin wrapper around Execa to run any file or command using any Node.js version.
Unlike nvm exec
it:
nvexeca
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.
Please reach out if you're looking for a Node.js API or CLI engineer (11 years of experience). Most recently I have been Netlify Build's and Netlify Plugins' technical lead for 2.5 years. I am available for full-time remote positions.
1import nvexeca from 'nvexeca' 2 3const { childProcess, versionRange, version } = await nvexeca('8', 'node', [ 4 '--version', 5]) 6console.log(`Node ${versionRange} (${version})`) // Node 8 (8.16.2) 7const { exitCode, stdout, stderr } = await childProcess 8console.log(`Exit code: ${exitCode}`) // 0 9console.log(stdout) // v8.16.2
1npm install nvexeca
node >=18.18.0
must be installed. However the command run by nvexeca
can use
any Node version (providing it is compatible with it).
This package is an ES module and must be loaded using
an import
or import()
statement,
not require()
. If TypeScript is used, it must be configured to
output ES modules,
not CommonJS.
To use this as a CLI instead, please check
nve
.
Executes command ...args
with a specific Node.js versionRange
.
Type: string
This can be:
12
, 12.6.0
or <12
latest
: Latest available Node versionlts
: Latest LTS Node versionglobal
: Global Node version
.nvmrc
or
package.json
(engines.node
field)local
: Current directory's Node version
.nvmrc
,
package.json
(engines.node
field)
or
similar filesglobal
version.nvmrc
,
package.json
(engines.node
field)
or
similar filesType: string
File or command to execute. Both global and local binaries can be executed.
Must be compatible with the specific Node versionRange
. For example npm
is
only compatible with Node >=6
.
Type: string[]?
Arguments to pass to the command
.
Type: object?
All Execa options are available. Please refer to Execa for the list of possible options.
The
preferLocal
option
is always true
.
The following options are also available.
Type: boolean
Default: false
Do not execute the command. This can be used to cache the initial Node.js binary download.
Type: boolean
Default: false
Whether to show a progress bar when the Node binary is downloading.
Type: string
Default: https://nodejs.org/dist
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
.
Type: boolean
Default: undefined
The list of available Node.js versions is cached for one hour by default. If the
fetch
option is:
true
: the cache will not be usedfalse
: the cache will be used even if it's older than one hourType: string
Default: process.arch
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
.
Type: string | URL
Default: process.cwd()
Current working directory of the child process.
When using the local
alias, this
also starts looking for a Node.js version file from this directory.
Type: Promise<object>
Promise
resolved after the Node.js version has been cached locally (if it has
not been cached yet).
If you want to wait for the command
to complete as well, you should await
the returned childProcess
.
1const { childProcess } = await nvexeca('8', 'node', ['--version']) 2const { exitCode, stdout, stderr } = await childProcess
Type:
ResultPromise?
childProcess
instance.
It is also a Promise
resolving or rejecting with a
Result
.
The Promise
should be awaited if you want to wait for the process to complete.
This is undefined
when the dry
option is true
.
Type: string
Node.js version passed as input, such as "v10"
.
Type: string
Normalized Node.js version. For example if "v10"
was passed as input,
version
will be "10.17.0"
.
Type: string
File or command that was executed.
Type: string[]
Arguments that were passed to the command
.
Type: object
Options that were passed to Execa.
The first time nvexeca
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.
If your code is using native modules, nvexeca
works providing:
>=8.12.0
(since N-API was not available or
stable before that)Otherwise the following error message is shown:
Error: The module was compiled against a different Node.js version
.
nve
: nvexeca
as a CLIexeca
: Process execution for humansget-node
: Download Node.jspreferred-node-version
:
Get the preferred Node.js version of a project or usernode-version-alias
: Resolve
Node.js version aliases like latest
, lts
or erbium
normalize-node-version
:
Normalize and validate Node.js versionsall-node-versions
: List all
available Node.js versionsfetch-node-website
: Fetch
releases on nodejs.orgglobal-cache-dir
: Get the
global cache directoryFor any question, don't hesitate to submit an issue on GitHub.
Everyone is welcome regardless of personal background. We enforce a Code of conduct in order to promote a positive and inclusive environment.
This project was made with ❤️. The simplest way to give back is by starring and sharing it online.
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 our guidelines. Pull requests are welcome!
ehmicky 💻 🎨 🤔 📖 | Nicolas Goudry 📖 | Pedro Augusto de Paula Barbosa 💬 |
No vulnerabilities found.
Reason
30 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 10
Reason
no dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
license file detected
Details
Reason
0 existing vulnerabilities detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no SAST tool detected
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2024-11-25
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More