nodenv is a great tool to manage multiple NodeJS versions and here are some of its commonly used commands summarized for quick reference.

Install/Uninstall node versions

$ nodenv install -l # list all available versions
$ nodenv install <version> # install a specific version
$ nodenv versions # list all installed versions (can also check ~/.nodenv/versions/)
$ nodenv uninstall <version> # uninstall a specific version

Set/Unset node versions

$ nodenv local <version> # will add a .node-version file into current directory with version name to override the global version
$ nodenv local --unset # unset and remove the .node-version file

$ nodenv global <version> # will write to ~/.nodenv/version as global version but it can be overriden by the local one if set above

$ nodenv local # show the current local node version used
$ nodenv global # show the current global node version used

$ nodenv local system # set local version to current system Node ($PATH)
$ nodenv global system # set global version to current system Node ($PATH)

$ nodenv shell <version> # set NODENV_VERSION env to override both local/global version set above
$ nodenv shell --unset # unset the NODENV_VERSION env

See official docs for more.

BACK TO TOP
Post tagged with: node, js