wisew wisew - 4 years ago 113
Node.js Question

What uses / respects the .node-version file?

I've searched Stack Overflow and GitHub (for both node and nvm) for an answer, but to no avail.

In some repos (like GitHub's Atom text editor, for instance), I've come across a

.node-version
file. It seems to be analogous to the
.ruby-version
standard file that works with any Ruby version manager to set the current version of Ruby correctly for the project.

But as far as I can tell from its documentation, nvm (Node Version Manager) only respects a
.nvmrc
file - it mentions nothing about a more general
.node-version
file. And there's no mention of
.node-version
in node's documentation (and I wouldn't expect there to be, since it doesn't ship with a version manager out of the box). I'm not aware of any other node version manager in heavy use.

So my question is, what is
.node-version
? What tools actually use it? Is it just an alias for
.nvmrc
, or am I missing something here?

Answer Source

There are at least two version managers for node.js, respecting .node-version file:

  • avn - Automatic Node Version Switching
  • nodenv - yet another version managers

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.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download