nodenv
Manage multiple Node.js versions
TLDR
Install a specific version of Node.js
Display a list of available versions
Use a specific version of Node.js across the whole system
Use a specific version of Node.js with a directory
Display the Node.js version for the current directory
Display the location of a Node.js installed command (e.g. npm)
SYNOPSIS
nodenv command [args]
PARAMETERS
commands
List all available nodenv commands.
local
Set or show the local application-specific Node.js version.
global
Set or show the global Node.js version.
shell
Set or show the shell-specific Node.js version.
version
Display the current Node.js version in use.
versions
List all Node.js versions known to nodenv.
shims
List all nodenv shims.
rehash
Rehash nodenv shims (create executables for Node.js commands).
install
Install a specific Node.js version.
uninstall
Uninstall a specific Node.js version.
prefix
Display nodenv's directory.
root
Alias for nodenv prefix.
DESCRIPTION
nodenv is a command-line tool that allows you to easily manage multiple Node.js versions on your system.
It avoids the problems of installing Node.js globally by allowing each project to specify and use a specific Node.js version without interfering with other projects or the system's default Node.js installation. It works by modifying your PATH to point to the desired Node.js version at runtime, ensuring that the correct version is used when you execute Node.js commands like node, npm, and yarn. This makes it indispensable for developers working on multiple projects with varying Node.js version requirements, eliminating conflicts and ensuring consistent environments. It simplifies the update process, and ensures compatibility between projects, tools and libraries.
CAVEATS
Requires proper shell integration (e.g., adding nodenv init to your shell's rc file).
Node.js versions must be installed separately using the nodenv install command.
PLUGINS
nodenv's functionality can be extended through plugins, allowing for integration with tools like nodenv-doctor for troubleshooting and nodenv-use for easier version switching.
SHELL INTEGRATION
Proper shell integration is crucial for nodenv to work correctly. This usually involves adding a snippet of code to your shell's rc file (e.g., .bashrc, .zshrc) to initialize nodenv.
HISTORY
nodenv was inspired by rbenv and ruby-build, adapting the version management approach to Node.js.
It gained popularity as a lightweight and non-intrusive alternative to nvm, focusing on simplicity and compatibility with existing workflows. Over time, it has been enhanced with features like plugin support and improved shell integration, becoming a widely adopted tool in the Node.js development community.