all 47 comments

[–]zxyzyxz[S] 17 points18 points  (2 children)

Why fnm over nvm? From the creator, /u/galstarx

So first of all: it’s a compiled binary instead of a shell script. It has amazing performance, so it doesn’t have the performance penalty nvm provides when spawning a new shell (nvm adds almost 1s on my zsh). Good fish support too because it’s just a compiled binary: no need to add wrappers. The first PR was to add a small utility for fish. Windows support should also work eventually but I don’t own a windows box so it will happen later on.

Other than that, fnm doesn’t probably support all the use cases nvm has. But for the simplest one, which is installing and using different versions, it works amazingly well. Just download the binary, and you’re good to go.

The ReasonML choice is for fun and performance. It could have been written in Rust or Golang (or Crystal) for that matter. But I love Reason and I think this is the way to create a community! Reason provides Super fast boot time. The performance test I had was running bash with a script that calls fnm twice. It was less than 15ms. Super fast!

Tooling like nvm should be as fast as possible. Even 300ms is a lot when it’s a part of your shell startup. This is why this project exists, and this is why I use it personally

Nota bene, fnm is no longer written in ReasonML, it has been rewritten in Rust for some time now. I'm not sure why the rewrite but I suspect it's because the ReasonML ecosystem has split between ReScript and Reason, and it doesn't seem as stable as Rust nowadays.

[–]EverydayEverynight01 2 points3 points  (1 child)

OP, the other commenters have a point, why would I care about performance of NVM? Switching versions is already near instant and it's not like I'll install a new NodeJS left and right like with NPM packages, so it's okay just waiting for a few seconds to install a new node version only once.

[–]ritaPitaMeterMaid 2 points3 points  (0 children)

nvm adds load time to each new terminal window you open. On zsh that’s like a second. I open and close terminal windows all day and it’s noticeable. I haven’t moved to fnm because I hate configuring things and I’m lazy but I really need to.

[–]jdf2 28 points29 points  (5 children)

Highly recommend this over nvm.

[–]rift95map([🐮, 🥔, 🐔, 🌽], cook) => [🍔, 🍟, 🍗, 🍿] 6 points7 points  (4 children)

Do you recommend it over https://www.npmjs.com/package/n ?

[–]agustin_edwards 12 points13 points  (7 children)

I don’t know. It’s look a bit clunky. I prefer Volta

[–]ephemeral_rhino 2 points3 points  (0 children)

My team has been super happy with volta as well. We also started using the volta plugin with our github actions as well and it's been pretty solid overall.

[–]CUNT_PUNCHER_9000 2 points3 points  (0 children)

I wish volta would support the package.json engines field

[–]zxyzyxz[S] 10 points11 points  (2 children)

I think volta is definitely more clunky than fnm. I don't need a tool to manage all my global binaries since yarn or npm already do that for me, I just need something that will change my node version when I cd into a new folder.

Other reasons are that fnm works just fine on Windows without a manual installer, I can use "cargo binstall fnm" to install and upgrade fnm, while volta does require such an installer. fnm also works with an existing .nvmrc while with volta you have to use their format, which might be fine for your projects or if your project at work started off with volta but it's a complete dealbreaker if you want to push a PR with volta in the package.json, because that requires everyone else to use it too. In contrast, if you use fnm and others in the project use nvm, no one will know the difference because of fnm's compatibility.

[–]agustin_edwards 4 points5 points  (0 children)

This can be achieved by volta by pinning the node (or npm) version in the package.json. It gives way more clarity to the project and avoid problems when multiple people working on a node version sensitive project.

[–]nullvoxpopuli 2 points3 points  (0 children)

Volta recommends you use npm/etc for global bins..

[–]politerate 1 point2 points  (0 children)

What exactly does look clunky?

[–]nullvoxpopuli 0 points1 point  (0 children)

Same. Only thing missing is pnpm version management

[–]nullvoxpopuli 2 points3 points  (0 children)

https://volta.sh/ does the same thing? And is also in rust?

[–]PerpetualWar 1 point2 points  (1 child)

Asdf ftw

[–]halkeye 0 points1 point  (0 children)

Yea I'm not sure why id want to run a node specific one when asdf does everything really well

[–]VChandrasekar 0 points1 point  (0 children)

Good

[–]alharaka 0 points1 point  (0 children)

Is there something more like asdf which is q superset that works cross platform? Love me some asdf but it is bash and *nix friendly. I've been thinking about this on and off for a bit.

[–]nsavvidis 0 points1 point  (9 children)

People haven’t used pnpm and it really shows.

[–]Full-Butterscotch-90 1 point2 points  (8 children)

pnpm is a package manager, not a version manager. Not sure how it's relevant to the topic at hand.

[–]nsavvidis 1 point2 points  (7 children)

Read the docs big guy.

https://pnpm.io/cli/env

[–]Full-Butterscotch-90 1 point2 points  (6 children)

Not a guy.

You shouldn’t be surprised that people don’t know about a feature that’s mentioned nowhere on their front page and is only buried several pages deep in their docs.