Comments (30)
Same for me when switching node version via fnm use
. I need to eval "$(fnm env --multi)"
to apply it
Note that I use fnm 1.11.0
from fnm.
Nevermind 🤦🏼 . I guess I had to restart iTerm as even though I had done source ~/.zshrc
.
It's working great now, and wow it's incredibly faster than nvm
😮 .
➜ node -v
v15.14.0
➜ fnm use 10
Using Node v10.24.1
➜ node -v
v10.24.1
Thanks for your time!
from fnm.
Ohhh, that looks like a common issue. I wonder if we can implement a fnm doctor
command that will search in your PATH for node
before FNM and alert for that, and maybe also provide the output for the commands above 😄
from fnm.
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
from fnm.
Sorry about that. can you run the following commands and report the output?
echo "PATH=$PATH"
env | grep FNM_
echo "node in $(which node)"
echo "find:"
find $FNM_DIR -maxdepth 2
from fnm.
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.
from fnm.
@Schniz thanks for the reply!
I'm running zsh and I added
# FNM
eval "$(fnm env)"
to my ~/.zshrc
file.
After sourcing the ~.zshrc
file. I do the following with the following result:
➜ fnm use 10
Using Node v10.24.1
➜ node -v
v15.14.0
Did I miss something?
from fnm.
I am still facing this issue. I have to use rehash to make this version stick.
╭─timod@cw-laptop ~
╰─$ node --version
v16.16.0
╭─timod@cw-laptop ~
╰─$ fnm use 18
Using Node v18.6.0
╭─timod@cw-laptop ~
╰─$ node --version
v16.16.0
╭─timod@cw-laptop ~
╰─$ fnm --version
fnm 1.31.0
╭─timod@cw-laptop ~
╰─$ rehash
╭─timod@cw-laptop ~
╰─$ node --version
v18.6.0
from fnm.
I ran into the same problem. Every node version switch required rehash
in my zsh shell. Turned out the problem was that no default node version was set in fnm. Once I ran fnm default x.x.x
versions started switching correctly
from fnm.
For anyone having an issue with fnm
conflicting with homebrew's installation of node on fish
I fixed it by moving the following line from ~/.config/fish/config.fish
to ~/.config/fish/conf.d/brew.fish
:
# ~/.config/fish/conf.d/brew.fish
export PATH="/opt/homebrew/sbin:/opt/homebrew/bin:$PATH"
from fnm.
Hey! Can you please try 1.9.1 and see if it fixes that?
from fnm.
The path is updated if you do echo $PATH
but in zsh I had to do a rehash
after every switch to get it to actually use that path
from fnm.
It is very weird, and I'm very sorry it happens to you.
I just tried it on a new installation in Fish and it does work. Are you sure that's the problem? can you please record it with asciinema so we'll see what's going on?
from 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 😄
from fnm.
I hope I got the fish syntax right!
from fnm.
Ok that's weird, I didn't change anything and now it is working as expected (btw I am using zsh) @Schniz
from fnm.
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. 🤷♂
from fnm.
Maybe there was a weird error on a previous version of the installation script?
This has to be well tested. It isn’t. I’m sorry about that!
from fnm.
I've just run into the same issue running the script in bash on linux (debian).
from fnm.
Closing for inactivity
from fnm.
hmmm, which zsh are you running? what's your setup?
from fnm.
That code snippet seems out of date and I can't seem to see how to auto rehash after changing :(
from fnm.
@Vinlock What do you mean?
This is the whole point of fnm. What are you experiencing?
from fnm.
can you share echo $PATH
with me? 😁
from fnm.
haha all good! happy that it works for you 😃
next time you can: source ~/.zshrc
and call it a day. Or open a new tab, and close the older one 😃
from fnm.
haha all good! happy that it works for you 😃
next time you can:source ~/.zshrc
and call it a day. Or open a new tab, and close the older one 😃
Yeah, I had done the source
command and it didn't effect anything it seemed for some reason. Though restarting iTerm made it work. New tab may have done the trick too. Just wondering what else it needed aside from source ~/.zshrc
🤔
from fnm.
maybe you still had nvm
installed on the current shell. I believe there is precedence for Bash functions over $PATH
executables
from fnm.
I guess my issue belongs here instead
#370 (comment)
from fnm.
I never took the time to give some feedback here and I'm sorry for that.
I gave fnm another try recently and it perfectly works and I no longer have this issue!
Thanks a lot for your work 💯
from fnm.
I ran into the same problem. Every node version switch required
rehash
in my zsh shell. Turned out the problem was that no default node version was set in fnm. Once I ranfnm default x.x.x
versions started switching correctly
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 fnm use 14
.
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?
from fnm.
Related Issues (20)
- `fnm install --corepack-enabled [VERSION]` prevents setting default + aliases at install
- `fnm use` donot call `rehash` when default set to system
- I found that FRM runs every time Creates new nodejs content in the C:\Users\*****\AppData\Local\fnm_multishells HOT 2
- Suggestion for Modifying PATH Export in install.sh to Enhance Compatibility and Safety
- `node_watchdog.cc` error when using the fnm install node, but not the same version of the Debian installed node HOT 1
- failed to fnm exec npm in git bash HOT 1
- [Idea] Include the name of the tool in the output?
- Usage in a monorepo HOT 2
- How to use in dockerfile ? HOT 1
- node.js HOT 1
- About the location of fnm (Linux) HOT 1
- 你好,我遇到了两个问题 HOT 2
- why dose the path is random ? how can i get a frozen path ? like nvm `/Users/xxx/.nvm/versions/node/v18.15.0/bin/node`
- Unable to download tar.xz file
- Is this library no longer updated?
- Please update the ring crate to 17.x
- Use `fnm env` to activate fnm not work in git-bash for windows HOT 3
- Modify the cd.cmd file, cd /d %1 can ensure switching between different drive letters
- Feature request: Port over nvm's "default global packages"
- Change directory not triggering use of default node version HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fnm.