use node
should support nvm aliases as well as node versions
#1270
Labels
use node
should support nvm aliases as well as node versions
#1270
Is your feature request related to a problem? Please describe.
As a work-around for #1269 I tried using
use node default
in a .envrc, and got an errordirenv: Unable to find NodeJS version (default) in (/Users/dcantrell/.nvm/versions/node)!
(the directory is what's in NODE_VERSIONS).Aliases are stored as files in
$NODE_VERSIONS/../../alias
and can either be a specific version, such as18.14.2
, or can be another named alias, or as a special case can benode
which means the highest installed version of node.Describe the solution you'd like
use node
should take any argument thatnvm use
can takeDescribe alternatives you've considered
I tried just putting
nvm use default
in .envrc, but because it's a function and not an executable command it didn't work:./.envrc:9: nvm: command not found
Additional context
You can get the prefix path for any nvm-installed version of node, and also any alias, thus:
dirname $(dirname $(nvm which $VERSION))
. For example:Doing that is a bit slow because it has to run node, so I suggest keeping the existing code and only doing the
nvm which
dance and trying again if the directory$node_prefix
calculated here doesn't exist.The text was updated successfully, but these errors were encountered: