LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

nodenv

Manage your app's Node.js environment

TLDR

List all available Node.js versions to install
$ nodenv install --list
copy
Install a specific Node.js version
$ nodenv install [18.17.0]
copy
Set the global default Node.js version
$ nodenv global [18.17.0]
copy
Set a local application-specific Node.js version
$ nodenv local [16.20.0]
copy
Show the currently active Node.js version
$ nodenv version
copy
List all installed Node.js versions
$ nodenv versions
copy
Uninstall a specific Node.js version
$ nodenv uninstall [16.20.0]
copy
Rehash shim executables after installing npm packages
$ nodenv rehash
copy

SYNOPSIS

nodenv command [options] [arguments]

DESCRIPTION

nodenv manages multiple Node.js versions per-project. After injecting itself into your PATH, any invocation of `node`, `npm`, `npx`, or other Node.js executables first activates nodenv, which uses shims to intercept commands and route them to the correct version.Version selection uses a hierarchy: NODENV_VERSION environment variable, `.node-version` file in current/parent directories, then the global version setting. This enables project-specific versions without manual switching.The `nodenv install` command is provided by the node-build plugin, included by default in most installation methods (e.g., Homebrew). It downloads prebuilt binaries or compiles Node.js from source.Shims are lightweight executables in `~/.nodenv/shims/` that determine the correct Node version before executing. After installing npm packages with executables, run `nodenv rehash` to create shims for them.The `.node-version` file in a project root specifies the Node version. When you enter the directory, nodenv automatically uses that version.

PARAMETERS

install VERSION

Install Node version.
uninstall VERSION
Uninstall Node version.
versions
List installed versions.
version
Show current version.
global [VERSION]
Set/show global version.
local [VERSION]
Set/show local version.
shell [VERSION]
Set shell-specific version.
rehash
Rebuild shim executables.
which COMMAND
Show path for command.
whence COMMAND
List versions with command.
root
Show nodenv root directory.
init
Shell initialization.
install --list
List available versions.
install --list-all
List all versions including old.

CAVEATS

Requires shell initialization in profile (`eval "$(nodenv init -)"` in .bashrc/.zshrc). New global packages need `nodenv rehash`. Building from source takes time and requires build dependencies. Not compatible with nvm. Shims add slight overhead to command startup.

HISTORY

nodenv was created by Will Farrington and Jason Karns around 2014, modeled after rbenv for Ruby. It brought rbenv's proven version management model to Node.js. The plugin architecture enables customization while keeping the core simple.

SEE ALSO

nvm(1), fnm(1), volta(1), asdf(1), rbenv(1)

Copied to clipboard
Kai