-
Notifications
You must be signed in to change notification settings - Fork 54
avn fails when .nvmrc contains additional lines #55
Comments
@lachlanhunt as the maintainer of nvm, I absolutely intend to break your use case in the future. Please do not use nvm's config file for anything that's not part of nvm. However, this is still an issue with avn; avn should not be relying on the file only ever having one line in it. |
I agree it shouldn't be abused for things unrelated to node versions. Unfortunately, that code is maintained by a different team and I'm not entirely sure why they're doing it. I'll follow up with them though to see if they'll agree to change it. But at the very least, ignoring lines beginning with # and treating them as comments would help. |
I think this is something that will be somewhat difficult to fix "correctly". Here are a few related issues that may further the discussion here: Here are some options to consider:
As I haven't been using |
|
@ljharb does that traverse from |
yes |
@ljharb thanks. So |
When .nvmrc contains more than 1 line, e.g. with comments, then avn fails.
This is a problem because a code base I have to work with at work has extended .nvmrc with some additional lines for specifying the yarn version, which is used by a different tool. These extra lines are ignored by nvm, but cause an error in avn.
The simplest fix would be to only read the first line of the file and ignore everything else that follows.
i.e. In lib/hooks.js, change this line:
to this:
Details
The output of
__avn_debug
in the directory with a.node-version
file is:avn
is loaded in my~/.{bash|zsh}{_profile|rc}
file with:nvm specific
nvm
user I am confirming that I did not install with HomebrewYes.
The text was updated successfully, but these errors were encountered: