# nvm-rs
A tool to manage Node.js versions on Windows.
## Requirements
- Windows
- Rust toolchain (edition 2024)
## Installation
### From source
```sh
cargo install nvm-windows
```
### From release
Download the latest binary from [GitHub Releases](https://github.com/Ouka2020/nvm-rs/releases).
## Quick start
```sh
# First-time setup (interactive prompt for symlink path)
nvm setup
# Set the root directory where Node.js versions will be stored
nvm root D:\nodejs
# Install the latest version
nvm install latest
# Install a specific version
nvm install 22.5.0
# Switch to a version
nvm use 22.5.0
# List installed versions
nvm ls
# List available remote versions
nvm ls --available
# Uninstall a version
nvm uninstall 22.5.0
```
## Commands
| `nvm setup` | | Interactive first-time setup (configures symlink path via prompt). |
| `nvm install <version> [--skip]` | `i` | Install a Node.js version. `version` can be `latest`, `lts`, or a semver. `--skip` skips checksum validation. Architecture is auto-detected. |
| `nvm uninstall <version>` | `un` | Uninstall a specific version. |
| `nvm list [--available]` | `ls` | List installed versions, or remote versions with `--available`. |
| `nvm on` | | Enable Node.js version management (creates junction link to the latest installed version). |
| `nvm off` | | Disable Node.js version management (removes junction link). |
| `nvm root [path]` | | Set or display the root directory. |
| `nvm current` | | Display the active Node.js version. |
| `nvm node-mirror [url]` | | Set or display the Node.js download mirror. |
| `nvm npm-mirror [url]` | | Set or display the npm download mirror. |
| `nvm use <version>` | | Switch to a specific version. Architecture is auto-detected. |
### Deprecated commands
| `nvm arch` | Removed — architecture is auto-detected. |
| `nvm proxy [url]` | Removed — proxy is deprecated. |
## Configuration
The configuration file is stored in the user's preference directory (via the `directories` crate, typically `%APPDATA%\nvm\`). The format depends on the enabled feature:
- **YAML** (default): `settings.txt`
- **TOML**: `settings.toml`
### Configuration fields
| `root` | Directory where Node.js versions are stored. |
| `node_mirror` | Node.js download mirror URL. Defaults to `https://nodejs.org/dist/`. |
| `npm_mirror` | npm download mirror URL. |
| `originalpath` | _(deprecated)_ Previous symlink target. |
| `originalversion` | _(deprecated)_ Previous version. |
### Environment variables
| `NVM_SYMLINK` | Path where the Node.js junction link is created (e.g. `C:\Program Files\nodejs`). |
## Features
The crate uses Cargo feature flags to customize the build:
| `default` | yes | Enables `yaml` config format. |
| `yaml` | (part of default) | Uses YAML-format config (`settings.txt` via `noyalib`). |
| `toml` | no | Uses TOML-format config (`settings.toml`). |
| `debug` | no | Enables `tracing` logging to console and rotating log files. |
### Build examples
```sh
# Default build
cargo build --release
# With TOML config + debug logging
cargo build --release --no-default-features --features toml,debug
# Debug logging only
cargo build --release --features debug
```
## Acknowledgements
This project is inspired by and based on [nvm-windows](https://github.com/nvm-windows/nvm). Many thanks to the original authors and contributors for their foundational work.
## License
MIT