You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
nenv/README.md

98 lines
1.8 KiB
Markdown

2 years ago
# nenv
A Node environment manager written in rust.
2 years ago
## 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
2 years ago
2 years ago
## Installation
2 years ago
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`.
2 years ago
## Usage
### Install node versions
```sh
# 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
```sh
nenv default latest
```
### Refresh installed binaries and upstream versions
```sh
nenv refresh
```
### Pinning binaries to specific node versions
```sh
# 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
```
2 years ago
### List nodejs versions
```sh
nenv list-versions
```
2 years ago
## Version detection
The node version nenv uses is controlled by
1. The `engines.node` config field in the `package.json` which is parsed as a semver requirement.
```json
{
"name": "my project",
"engines": {
"node": "18"
}
}
```
2. The `.node-version` file in the current or parent directories which contains the version string.
```
19.4.0
```
3. The `NODE_VERSION` environment variable.
4. The default version set with `nenv default`.
2 years ago
## License
GPL-3.0