fnm
fnm copied to clipboard
`fnm use system` leaves broken `node` command in Bash on macOS ...
hi there :wave:
thanks for the awesome tool 🙏 ❤️ i've very much enjoyed using fnm
with one painful exception - fnm use system
ends up breaking my $PATH
.
>>fnm --version
fnm 1.22.9
>>cd ../my-project/
Using Node v10.23.1
>>node -v
v10.23.1
>>fnm use system
Bypassing fnm: using system node
>>node -v
-bash: /var/folders/c7/369898450l31qzjh1qrf9x7w0000gn/T/fnm_multishell_24180_1611881005823/bin/node: Not a directory
to fix, i end up manually removing the above path from the $PATH
env var. here's some info from my setup:
within my .profile
, i have:
eval "$(fnm env --use-on-cd)"
i'm running:
OS: 10.15.7 (Catalina, Intel)
Shell: GNU bash, version 3.2.57(1)-release (x86_64-apple-darwin19)
any pointers would be very much appreciated 👍
Hmm.
Seems like Bash is caching the full paths. hash -r
should fix that.
$ eval "$(fnm env --use-on-cd)"
Using Node v12.20.1
$ fnm use 14
Using Node v14.15.1
$ node -v
v14.15.1
$ fnm use system
Bypassing fnm: using system node
$ node -v
bash: /var/folders/cs/pr19qm154hxcg8_zvbrjwy91l6v056/T/fnm_multishell_85385_1611997123701/bin/node: Not a directory
$ hash -r
$ node -v
v12.20.1
This can be "fixed" by adding set +o hashall
to fnm env
output. I wonder what the performance implications are for this move.