From nvm to fnm!
I’m playing around with my new M2 Pro-powered MacBook. I was between two decisions: migrating from my previous Mac, or going with a fresh install. I’m moving from an 16" MacBook Pro with an Intel Core i7, which is running an operating system migrated 3 years ago from a MacBook Air I was using while travelling. Maybe it’s time to start with a fresh setup, given also the quite different architecture of the two laptops.
After setting up some tools, I noticed that zsh
was loading slower then before. After some research, I found that it was due to nvm
. It’s a well known issue. Googling around showed two options.
- Using a lazy-loading approach for
nvm
, so it’s loaded only when needed. - Switch to
fnm
, a Node.js version manager written in Rust.
I went for the second one - see here - and zsh
now is loading like before: immediately.
And I didn’t notice there’s a quick and easy way to manage different versions of Node for multiple projects: just place a .node-version
file in the root of the app and define the needed version - like v16.15.1
. fnm
will automatically pick the right version, without your intervention.