fnm
fnm copied to clipboard
Some hitches in the first-run experience
Hi Gal,
Thanks so much for this tool! I've been bothered by nvm slowing down my shell startup for a long time, and fnm is making my life so much easier!
Since you presumably rarely encounter the setup-from-scratch experience, I thought I'd share some minor usability hitches I ran into when I set up fnm. Perhaps these might simply be addressed by printing some helpful messages.
Here's what I did:
- Download the latest binary and place it in
$PATH
- Add
eval "$(fnm env --multi)"
to.bashrc
-
node
still isn't found (as expected), so I runfnm install
-
node
still isn't found (surprisingly), so I check/tmp/fnm-shell-1234567
and notice that it is a broken symlink to~/.fnm/aliases/default
-
fnm ls
shows I havesystem
andv14.3.0
; I'm trying to have thedefault
always be the latest Node version, likenvm
'sstable
alias, and in a hurry I wrongly(?) assume thatsystem
serves this purpose, so I tryfnm alias system default
-
node
still isn't found, so I check~/.fnm/aliases/default
; it's a broken symlink to/dev/null/installation/installation
- I run
fnm alias v14.3.0 default
, and now it works!
Hi, thanks for this. Really helpful.
I wonder whether this would be easier if you have tried the installation script/Homebrew installation process. I also consider suggesting to use the installation script for Mac using Homebrew because the Homebrew formula does not update .bashrc
, and the installation script does it well.
I'm trying to have the
default
always be the latest Node version, likenvm
'sstable
alias, and in a hurry I wrongly(?) assume thatsystem
serves this purpose, so I tryfnm alias system default
I should release v1.21.0
with the changes, that allow aliasing to an alias: https://github.com/Schniz/fnm/compare/v1.20.0...master
In order to install the latest Node you can run fnm install latest
. I'd recommend installing a specific LTS so you know what you're installing. Also, on every project, I add a .nvmrc
or .node-version
file so my shell will automatically switch versions instead of relying on a default one.
Thanks!
The reason I used the manual instructions instead of the install script is that I'm running Ubuntu and have a carefully maintained .bashrc, and install scripts can sometimes go wrong and put things in the wrong place. So I figured I'd just err on the safe side and follow the manual instructions.
I wonder if it might make sense for fnm to print a message if you haven't installed any Node version, with hint to run fnm install latest
.
Also, could it make sense to have an automatic latest
alias, and have the default
alias point to latest
by default? This way people wouldn't have to wire up aliases when they set up fnm.