Skip to content
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

Change directory not triggering use of default node version #1094

Open
yusuphgammut opened this issue Jan 26, 2024 · 1 comment
Open

Change directory not triggering use of default node version #1094

yusuphgammut opened this issue Jan 26, 2024 · 1 comment

Comments

@yusuphgammut
Copy link

yusuphgammut commented Jan 26, 2024

Hi fnm team. First congrats for writing and maintaining this tool. It's supper useful and fast.

I've just installed it (adding eval "$(fnm env --use-on-cd)" to my ~/.zshrc file) and I noticed that when I enter a project that has a node version specified via .nvmrc file it automatically triggers the use of that version, but when I move outside of that folder it doesn't trigger the use of the default one. This is what I see:

> fnm list
* v18.10.0
* v20.11.0 default
* system
> node --version
v20.11.0
> cd my-node-project
Using Node v18.10.0
> node --version
v18.10.0
> cd ..
> node --version
v18.10.0

I'm not sure if this is the desired behavior or if it's an issue. I used nvm till today and it triggered the use of the default node version when moving outside the project.

Additional info:

  • OS: macOS v14.3
  • Terminal: Alacritty v0.13.0-dev
  • Shell: Zsh v5.9
  • FNM: v1.35.1 installed via Homebrew v4.2.5
@gpetrioli
Copy link

gpetrioli commented Feb 6, 2024

I am having the same issue.

However, as a workaround, you can the set --version-file-strategy to recursive and then go to your top folder (i went to ~) and add a .nvmrc file there.

To set the flag, edit your .nvmrc file and edit the

eval "$(fnm env  --use-on-cd)"

to

eval "$(fnm env --version-file-strategy recursive --use-on-cd)"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants