What uses / respects the .node-version file?
.node-version
is a file read by various tools on an individual basis for specifying the target node version. Version managers which use/respect it include (in alphabetical order):
- asdf-nodejs Node.js plugin for asdf version manager. (macOS, Linux)
- avn Automatic Version Switching for Node. (macOS, Linux)
- chnode Changes shell's current Node.js version by updating $PATH
- direnv unclutter your .profile. (macOS, Linux)
- fnm ð Fast and simple Node.js version manager, built in Rust. (macOS, Linux, Windows)
- n Interactively Manage Your Node.js Versions. (macOS, Linux)
- nenv Groom your app’s Node environment with nenv (macOS, Linux)
- nodenv Manage multiple NodeJS versions. (macOS, Linux)
- nodist Natural node.js and npm version manager for windows. (Windows)
- nve Run any command on specific Node.js versions (macOS, Linux, Windows)
- nvm.fish Node.js version manager lovingly made for Fish. (macOS, Linux)
- nvs Node Version Switcher - A cross-platform tool for switching between versions and forks of Node.js. (macOS, Linux, Windows)
- setup-node (configuration) Set up your GitHub Actions workflow with a specific version of node.js
Other products which test for .node-version include:
- Cloudflare Pages Build fast sites. In record time.
- Hostman Hosting platform that deploys your web applications
- netlify Instantly build and deploy your sites to our global network from Git.
- paketo Your app, in your favorite language, ready to run in the cloud
- preferred-node-version Get the preferred Node.js version of a project or user
- render A Cloud for the New Decade
- starship ☄ð️ The minimal, blazing-fast, and infinitely customizable prompt for any shell!
I documented usage and some supported features here: https://github.com/shadowspawn/node-version-usage
There are a few version managers for node.js respecting .node-version
file:
- avn - Automatic Node Version Switching
- nodenv - Yet another version managers
- asdf - Extendable version manager with support for Ruby, Node.js, Elixir, Erlang & more, provided you configure it accordingly
- nvs - Node Version Switcher
There may be some other version managers, but I'm not aware of them.
I don't know which particular version manager Atom uses. nodenv have more stars on GitHub, but avn looks more mature and better maintained for me, not to mention its compatibility with both n and nvm.
(disclosure: I maintain http://nvm.sh)
The most-used version managers for node are without a doubt nvm
, nave
, and n
.
nvm
is for modifying individual shell sessions to use the version you want.
nave
is for launching subshells with the version you want loaded.
n
is for switching a single system-wide version of node.
nvm
uses a .nvmrc
file, which like .ruby-version
, contains the version-ish string X you'd normally couple with nvm use X
or nvm install X
. nvm use
or nvm install
by itself will locate the .nvmrc
file, as will simply sourcing nvm
upon opening a new shell.
It appears nave
supports a .naverc
file, but I'm not too familiar with its usage.
n
doesn't appear to support any such config, but as it's system-wide, it doesn't really make as much sense to do so.
avn
supports .node-version
and attempts to provide automatic version switching by hooking into cd
, after nvm
decided that was too invasive a behavior to include.