node-version-usage icon indicating copy to clipboard operation
node-version-usage copied to clipboard

Consider adding note for `nvm` about how to use `.node-version` in a compatible way with `nvm`

Open darcyparker opened this issue 4 years ago • 5 comments

Although nvm does not officially support .node-version yet (See nodejs/version-management#13, nodejs/version-management#21), you can use a .node-version with nvm like this: ln -s .node-version .nvmrc

This works because, .nvmrc supports the .node-version syntax (with an without the v prefix). So .nvmrc is a superset of .node-version.

If one is careful to follow the .node-version specification here, a symbolic link from .node-version to .nvmrc is a good solution until nvm officially supports it.

BTW: https://github.com/volta-cli/volta/issues/983 is considering support of .node-version and referenced this repo.

darcyparker avatar May 03 '21 18:05 darcyparker

Thanks for volta link, I am subscribed to that issue now.

My current focus is products which support or use .node-version, and I do not wish to add work-arounds for other node version managers or products. However, this issue does now provide your info for anyone who searches for nvm here in the future.

Related links in nvm-sh:

  • https://github.com/nvm-sh/nvm/issues/794 (opened 2015)
  • https://github.com/nvm-sh/nvm/issues/2292
  • https://github.com/nvm-sh/nvm/pull/1625

shadowspawn avatar May 04 '21 00:05 shadowspawn

For interest, same work-around of linking mentioned here: https://github.com/xmldom/xmldom/pull/52#issuecomment-651976549

shadowspawn avatar May 04 '21 00:05 shadowspawn

That sounds fair about only focusing on products that use .node-version. And you're right, someone can easily find the work-around method here by searching and elsewhere.

darcyparker avatar May 04 '21 13:05 darcyparker

Given the popularity of nvm, I'd actually support having a note explicitly indicating its lack of support for .node-version, just to avoid possible confusion due to its absence from this list.

waldyrious avatar May 11 '21 09:05 waldyrious

I'll reopen this to give it some more visibility and opportunity for feedback (👍) , since a few people have already found it since being closed. That might indicate I was correct about people finding the info, or might indicate worth documenting! 😄

shadowspawn avatar May 14 '21 05:05 shadowspawn

I have added a note to README that nvm does not support .node-version, with a link to this issue.

shadowspawn avatar Nov 13 '22 04:11 shadowspawn

I have added a note to README that nvm does not support .node-version, with a link to this issue.

Thanks! For reference, that was done in 714de96d089bdbfa48a7e95c74d2bdf27aeb2358.

waldyrious avatar Nov 13 '22 09:11 waldyrious