jorgebucaran / nvm.fish

The Node.js version manager you'll adore, crafted just for Fish
https://git.io/nvm.fish
MIT License
2.06k stars 69 forks source link

Problems with .nvmrc #176

Closed benjick closed 2 years ago

benjick commented 2 years ago

Hello

I'm using nvm, version 2.2.6 and it seems it can't pick up my .nvmrc. Not really sure what I should do. It works fine if I specify the version but I would prefer it to adhere to the rc file.

Screenshot 2022-03-16 at 11 10 37
jorgebucaran commented 2 years ago

@benjick Thanks. We read it but failed to print it. Should be good now.

The other issue you are having is that nvm.fish wants you to install the version first, then run nvm use to switch to it.

benjick commented 2 years ago

@jorgebucaran hey, thanks for the quick reply/commit 🙏 seeing another issue now though

.nvmrc is utf8 with CRLF

Screenshot 2022-03-16 at 20 53 17
nvm -v
nvm, version 2.2.7
jorgebucaran commented 2 years ago

@benjick Perhaps a Fish issue? We just use read v <$file to read the version into a variable.

https://github.com/jorgebucaran/nvm.fish/blob/e4e603af527677dc954c5e6d1730bdf36f0e5ba1/functions/nvm.fish#L4

Can you run the following and make sure you get the expected result?

echo 16 > .nvmrc
read v <.nvmrc 
echo $v
benjick commented 2 years ago
echo 16 > .nvmrc
read v <.nvmrc
echo $v
16
jorgebucaran commented 2 years ago

And what happens if you run nvm install or nvm use with that .nvmrc?

You can help me debug this by adding some logging after we read the version into $v. Are we picking up the version or not? As a Fish script, I don't usually have to worry about file encoding or control codes, so this intrigues me.