A super fast alternative to NVM is now open source onĀ GitHub tl;dr: is a very fast version manager, ~40x faster than NVM. It supports files and out of the box. It works on Linux and Mac and distributed as a single executable - and it is ! fnm Node.js .nvmrc Fish shell open source on GitHub So, Two weeks ago, I had opened a new tab on my terminal and complained in agony: āOh dear god! Every time I open a new terminal it takes like ā. My teammates looked at me funny. āThis is clearly sub-optimal and hurts my focus, and I believe itās NVMās fault.ā one second! I found itās NVM that is at fault after I did a search around my file, checking which line takes the most time. It was NVMās initialization. I have been using NVM for years, and I always wanted to write a simple replacement, because my use cases are pretty simple: .zshrc I want to be able to download any Node version (like ) nvm install I want to be able to switch between them easily (like ) nvm use These tasks arenāt hard to solve. Node.js binaries are distributed in tarballs on their website, and switching versions shouldnāt be more than just changing a symbolic link around. So, why is NVM so slow? I thought about writing it as a simple Bash script, just like NVM, but I wanted it to be interesting and fun. Also, not all machines have Bash installed, or there might be problems integrating with Bash. I have used for years, and in order to use NVM, I had to use a wrapper that fixes things. It wasnāt easy. Using a real executable, on the other hand, would work on every shell! Fish shell The first prototype My first prototype was a TypeScript app. I packaged it with , making it a self-contained executable, because I didnāt want to have dependency on Node. I wanted it to work on a system without Node installed (so the first version of Node would be installed using fnm!) Zeitās pkg Nodeās startup time wasnāt good enough for me. Just spawning a āhello worldā takes around 200ms, which is good for servers, and for command line utilities that you donāt use frequently, maybe, but some people use on every , so their Node version will always be in sync. 200ms penalty for every is madness and would make the tool unusable. nvm cd cd So it seems like I need to write it in a language that is compiled (so no dependencies on the host system), and with a fast boot time. Four languages came to mind: Go, Rust, Crystal and Reason/OCaml. A Native ReasonĀ App I chose Reason for many Reasons (hehe), . I had used and , two awesome packages that make the development workflow for native Reason/OCaml apps easy-peasy for Node.js developers. some of them are written in another post [esy](https://esy.sh/) [pesy](https://github.com/jordwalke/pesy) works like a super-powered : it installs packages from npm or OPAM (OCaml package manager) and . It also manages a sandbox for the OCaml runtime/dependencies for you, so different OCaml installations wonāt interrupt each other. generates build configurations for , OCamlās build tool, right from the file. esy [yarn](https://yarnpkg.com/) stores it in a global cache pesy Dune package.json When using both packages, it feels just like Node developmentāāāeverything works with a single file, with minimum configurations. It can also help other Node devs, just like it helped me, to contribute to the project, because Reason syntax is very close to JSā, and the toolchain feels _very_JavaScript-ish. package.json I had built the first prototype, and tested its performance. I had two test files, one using NVM and one using fnm. Both tests spawned a plain Bash, called the āinitializationā of the target (NVM/fnm), and then switched to the Node version specified in file in the directory using the target. I ran it 10 times for each binary, and the results were amazing: .nvmrc NVMās test case was around 600ms on my machine fnmās test case was around 15ms on my machine So in that test, on my MacBook Pro, . Thatās pretty huge, despite not being very scientific. fnm was 40 times faster than NVM A real-time animated video is on the repoāsĀ README Releasing toĀ Public When I had started working on fnm, I joined the Reason Discord server, and asked some help from people. I found that community is . When I decided to release, I wrote a short message on the channel and immediately got great feedback, telling me itās a great idea. so nice #native-development The community aspect is such an important part of , and Reasonās community feels even nicer than JSāāāāmaybe because the community is still small, but it is welcoming. JavaScript very I released fnm to GitHub as open source, tweeted about it and went to bed. When I woke up, My twitter notifications were on fire š„ The repo had more than 500 stars šÆšÆšÆšÆšÆ fnm was #1 on HackerNews š No one on Reddit/HackerNews called me an idiot! 𤔠(a rare sight) Thatās a big deal. What Now? fnm has some features still missing. Here are only a few things we want to add: Windows support Version aliases Support downloading latest LTS Per-shell usage Drop dependency on and tar curl ⦠and more! So if you feel like youāre ready to use it and start working faster, or youāre a JS/Reason developer willing to contribute to an open source project, ! download fnm and join us on GitHub