6 releases
0.5.2 | Feb 5, 2023 |
---|---|
0.5.1 | Feb 4, 2023 |
0.4.2 | Jan 23, 2023 |
#1855 in Development tools
22 downloads per month
74KB
2K
SLoC
nenv
A Node environment manager written in rust.
Features
- Written in fast and safe rust
- Multiple active nodejs versions at the same time
- Configuration for project specific versions
- Version matching with semver expressions
Installation
You can either
- Install the application with cargo by downloading the repo and running
cargo install --path .
inside - Download the binary from the releases page
Now to initialize everything install any nodejs version with nenv install <version>
.
Afterwards add the bin
directory to your PATH
variable.
On windows this should be C:\Users\<yourusername>\AppData\Roaming\nenv\bin
.
On linux this will be ~/.local/share/nenv/bin
.
Usage
Install node versions
# install the latest available node version
nenv install latest
# install the latest lts version
nenv install lts
# install the latest 14.x.x version.
nenv install 14
Change the system-wide default version
nenv default latest
Refresh installed binaries and upstream versions
nenv refresh
Pinning binaries to specific node versions
# rome will always be executed with the lts version
nenv pin rome lts
# tsc will always be executed with the latest typescript version
nenv pin tsc latest
# undo
nenv unpin rome
nenv unpin tsc
List nodejs versions
nenv list-versions
Version detection
The node version nenv uses is controlled by
- The
engines.node
config field in thepackage.json
which is parsed as a semver requirement.
{
"name": "my project",
"engines": {
"node": "18"
}
}
- The
.node-version
file in the current or parent directories which contains the version string.
19.4.0
- The
NODE_VERSION
environment variable. - The default version set with
nenv default
.
License
GPL-3.0
Dependencies
~26–42MB
~663K SLoC