Overview

No need to setup anything, just run the use-node, then you can use the right node version under your shell.
- Works the same across Windows, macOS, and Linux.
- No options, no configs, just run
use-node under your node project.
- Auto-detect the standard engines config recursively from all parent folders.
- Auto-choose the fastest registry to download node.
- Auto-cache the node binary.
- Lightweight and fast.
- Reports every side-effect it makes on the system, such as where the node is installed.
Installation
Go to the release page and download the use-node binary, run the command below to install use-node to your PATH:
use-node -i
On macOS you might need to do below to trust the binary before run it:
xattr -r -d com.apple.quarantine /path/to/use-node
If you have golang installed:
go install github.com/ysmood/use-node@latest
Use it outside node project
If you want to use it without the package.json file, just specify the node version you want:
use-node v19
If you don't specify a version, it will use the latest node version by default.
Shell Setup
If you want to let it setup PATH env on shell startup, on unix like OS add this line to your .bashrc or .zshrc files:
export PATH=$PATH:$(use-node -p v19.8.1)
If you want to run use-node whenever you cd to a directory, add this line to your .bashrc or .zshrc files:
eval "$(use-node -s)"
On Windows, run use-node -p v19.8.1, copy the output directory path and add it to PATH.
How it works
When you run the use-node. It first recognize the engines field in package.json and automatically download or use the best node version from cache.
Then it spawns a sub-shell and inject the node path to your PATH, your current stdio will transparently pipe to the sub-shell.