-
Notifications
You must be signed in to change notification settings - Fork 413
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fnm use
doesn't switch node version
#92
Comments
Hey! Can you please try 1.9.1 and see if it fixes that? |
The path is updated if you do |
It is very weird, and I'm very sorry it happens to you. |
Same for me when switching node version via Note that I use fnm |
Can you show me a shell that runs the following? fnm env --multi | source
echo "-> NODE: "(which node)
echo "-> VER: "(node -v)
echo "-> PATH: $PATH"
env | grep FNM
fnm ls
fnm use <YOUR VERSION HERE>
echo "-> NODE: "(which node)
echo "-> VER: "(node -v)
echo "-> PATH: $PATH"
env | grep FNM I can't get it to fail on my machine - but maybe this will help me 😄 |
I hope I got the fish syntax right! |
Ok that's weird, I didn't change anything and now it is working as expected (btw I am using zsh) @Schniz |
I had the same problem using fnm installed via the bash script in ZSH. I deleted it and reinstalled it using the homebrew installation, and it's working now. 🤷♂ |
Maybe there was a weird error on a previous version of the installation script? |
I've just run into the same issue running the script in bash on linux (debian). |
Sorry about that. can you run the following commands and report the output?
|
That was pretty helpful actually! I realized the issue is because linuxbrew inserted its init script in ~/.profile, which loads bashrc followed by linuxbrew init. Node was initially installed via linuxbrew, which then became the default no matter what I did with fnm. |
Ohhh, that looks like a common issue. I wonder if we can implement a |
Closing for inactivity |
I have the same issue, but I refuse going back to nvm because it's just so slow and I love the speed of fnm :) I ended up doing something like this (since I'm not very good at bash/zsh), rehashing on each fnm use seems to solve it. #FNM
eval "`fnm env --multi`"
#FNM autoload
autoload -U add-zsh-hook
_fnm_autoload_hook () {
if [[ -f .node-version && -r .node-version ]]; then
echo "fnm: Found .node-version"
fnm use
rehash
elif [[ -f .nvmrc && -r .nvmrc ]]; then
echo "fnm: Found .nvmrc"
fnm use
rehash
else
fnm use system --quiet
rehash
fi
}
add-zsh-hook chpwd _fnm_autoload_hook && _fnm_autoload_hook |
hmmm, which zsh are you running? what's your setup? |
That code snippet seems out of date and I can't seem to see how to auto rehash after changing :( |
@Vinlock What do you mean? |
@Schniz thanks for the reply! I'm running zsh and I added
to my After sourcing the
Did I miss something? |
can you share |
Nevermind 🤦🏼 . I guess I had to restart iTerm as even though I had done It's working great now, and wow it's incredibly faster than
Thanks for your time! |
haha all good! happy that it works for you 😃 |
Yeah, I had done the |
maybe you still had |
I guess my issue belongs here instead |
I never took the time to give some feedback here and I'm sorry for that. |
I am still facing this issue. I have to use rehash to make this version stick.
|
I ran into the same problem. Every node version switch required |
For anyone having an issue with # ~/.config/fish/conf.d/brew.fish
export PATH="/opt/homebrew/sbin:/opt/homebrew/bin:$PATH" |
The same happens to me. But I intentionally want to use system as default. If I set 20 as default, it switches to 14 when needed. If I set system as default, I need to use rehash every time, even if I manually enter To keep up with the latest node version, I prefer using system as dnf takes care of it, and then I only use fnm for project-specific requirements. Does anyone have an idea why I need rehash when fnm default is set to system? |
I have this error on a Windows computer when I try to use "fnm use": "error: We cannot find the environment variables needed to replace the Node version." And even placing the environment variable "FNM_DIR" in the "path" I get the same problem and I don't know what to do. Does someone know how to solve this problem? I would appreciate it very much |
I had "We can't find the necessary environment variables to replace the Node version."
|
Hi,
With a clean install of fnm 1.9.0 and fish shell version 3.0.2, the fnm use command doesn't work as expected.
steps to reproduce
fnm ls
is just fineAnd Testing node version gives the expected output
Now installing latest LTS 10.15.3 and trying to switch to that version is not working
Again,
fnm ls
says that everything is fine(with a blue-green highlight on the 10.15.3 version indicating it's the current version)
However node version is still 8.10.0
Additional information
I've tried to locate which version is pointing the node symbolic link to:
And /tmp/fnm-shell-2857505 is linking /tmp/fnm-shell-2857505 -> /home/spiroid/.fnm/aliases/default/ which seems to be the issue here, as i guess it should link /home/spiroid/.fnm/current/ right ?
Thanks for your help
The text was updated successfully, but these errors were encountered: