fish-nvm: Default version / .nvmrc not working
Not sure why this is happening - nvm
works well normally, but it’s a pain to manually select a specific version every time.
A new shell starts up with a node version of ‘none’.
I’ve manually set a default version through nvm
and verified that it works correctly in bash.
I don’t have a custom $NVM_DIR
.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 35 (15 by maintainers)
@jiaweihli have you tried running
nvm alias default 6.9.0
this will set your default node version to 6.9.0 (feel free to chose another one) whenever you open a new terminal?@Lordnibbler why are you putting the
.nvmrc
on your home path~/
? that file should be inside your project folder. Let’s imagine you are working on project that requires a very specific node version, let’s sayv4.4.4
you would do something like this:Et voilà now when you use node inside this folder, it will pick the .nvmrc and use that specific version.
@lukiano that’s the default behaviour check https://github.com/creationix/nvm#deeper-shell-integration
If you want you can create some sort of script that listens for folder changes and checks if there’s a
.nvm
@FabioAntunes, thanks for the response!
I just realized that I’m in the fisherman/nvm instead of creationix/nvm… woops!
It actually appears as though I needed to call
nvm use
(with no arguments) once in the folder with the.nvmrc
file and it started working after that.^^^ I guess this is for anyone who stumbles upon this issue from a google search even if you aren’t using fisherman.
Ok, I discovered your problem @tanc, you have node installed outside of nvm, that makes node global available. So since you already have node on your $PATH,
fish-nvm
doesn’t sourcenvm
. One solution is either uninstalled it and just use nvm, or wait a couple of days. I’m working on fix for this, so even if node exists we always sourcenvm
@jbucaran That’s why I created this so whenever you use
node
,npm
,nvm
and now alsoyarn
, it checks if there’s a node already sourced, if not either source a local.nvmrc
or source the default alias.@jiaweihli I’m really sorry, but are you sure you have
nvm
properly installed? I have been using this since day one and I have never had any problems. I also have a couple of friends who use this and everything works for them. I know this sounds cliché, but could you please uninstallnvm
and install it again usingfisherman
It does work correctly if I set
nvm use default
in~/.config/fish/config.fish
, but this adds an extra 1 second overhead to every new terminal.@FabioAntunes Yes, I’ve done that and it works correctly in bash - but not in fish.
@jiaweihli Just a reminder that there is also:
I use verman personally.