https://github.com/ysmood/use-node
The next generation node version manager
https://github.com/ysmood/use-node
nodejs nvm semver version-manager
Last synced: 3 months ago
JSON representation
The next generation node version manager
- Host: GitHub
- URL: https://github.com/ysmood/use-node
- Owner: ysmood
- License: mit
- Created: 2023-04-01T05:24:58.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2023-07-11T03:03:05.000Z (about 2 years ago)
- Last Synced: 2025-05-12T13:56:20.646Z (5 months ago)
- Topics: nodejs, nvm, semver, version-manager
- Language: Go
- Homepage:
- Size: 28.3 KB
- Stars: 29
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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](https://docs.npmjs.com/cli/v9/configuring-npm/package-json#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](https://github.com/ysmood/use-node/releases) and download the use-node binary, run the command below to install use-node to your [PATH]:
```bash
use-node -i
```On macOS you might need to do below to trust the binary before run it:
```bash
xattr -r -d com.apple.quarantine /path/to/use-node
```If you have golang installed:
```bash
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:
```bash
use-node v19
```## 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:
```bash
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:
```bash
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.[path]: https://en.wikipedia.org/wiki/PATH_(variable)