This leads to uninstalling and reinstalling the correct version of each language, which wastes plenty of time.įortunately, switching between different versions can be easy with version managers like Node Version Manager, rbenv for Ruby, or pyenv for Python. When working with several projects at a time, you may need different versions of the programming language in which you are writing. I believe in building through collaboration and contribution. Go and check fnm there is a high change you may want to switch as well (especially if you’re fish user, or if you are using asdf currently and are not happy with how it performs).Hulya Karakaya Follow A frontend developer interested in open source and building amazing websites. It did take me some time, but now this is a pure joy working again. I am happy that I have found a perfect solution for myself. If you would like to have a look/use it, you could find it in the same repo: Conclusion So the very last thing I needed was to change the script I have originally developed for asdf-nodejs so that it supports fnm.
After looking at the code I have realized that it ( fnm) relies on $SHELL variable to be set properly. The only problem I have encountered was that at first it didn’t seem to detect being run in fish environment. Its syntax is quite easy to get used to, but more importantly it works perfectly well under fish. So fnm stands for Fast Version Manager and it does what it says. I have re-evaluated nvm but experiencing the pain of setting default NodeJS version each time… no, it was not something I wanted to get back into.Īnd then at some point I have found… fnm! FNM to the rescue! I have tried some other version managers for NodeJS. I knew, I felt there just “has to be a better way”… I have experimented with the SKIP_RESHIM=1 flag, that help a lot, but not as much as I hoped for, and the times were not even close to those I have experienced when using nvm. So I started reading about the issue, and it seems this is something that community behind asdf (or asdf-nodejs specifically) is very well aware of: The times I got were pretty horrible: name I have installed another NodeJS version and run the script to test it (using time). If you’re curious - you may find it in my dotfiles repository on my github (direct link: ). It took me some time (as I wanted to have it polished). Just for the future convenience I have spent some time in the evening developing small script that would automate installing new version of NodeJS and installing global packages. It seem that installing packages took ages in comparison with nvm!Īt first I thought this was just my impression, there were dozens of packages to install, each having some dependencies… I must have been wrong.
And it was this moment that I realized some strange. I did that manually by creating a list of packages installed (using npm list -g -depth=0) and then passing package names to the npm i -g. The very last thing that I had to do was installing packages I usually need. So right after roughly a minute I had asdf supporting NodeJS versioning. Installing a new version of NodeJS is not harder either: Installing a new plugin for asdf is super simple:
My friend suggested me to try asdf for NodeJS - and I was all like ‘why haven’t I thought of it before’? ASDF
I tried some additional wrappers - but these affected either fish start performance or were not convenient for me to use. I have spent some time trying to find some solution for this issue, but nothing worked as I wanted. For some strange reason I had to remember every time on setting default version, otherwise npm and all the globally installed packages were not seen as available. Nvm just doesn’t seem to work well under fish. That is super convenient, as it happens automatically, so after installing new version you end up with all the packages you need.
nvm has unique ability to install new version of NodeJS reinstalling all packages (global ones) that are installed for the currently used version, the syntax is as follows:
Why? Mainly it was due to the fact that I was pretty happy with nvm that I started using couple of years ago. But I newer actually used it for NodeJS version management. It syntax is easy to remember and concise. Some time ago I shared how much I liked the way asdf simplified version management of some of the developer tools (mostly: programming languages) for me.Īsdf is mature and offers a lot of ready to use plugins.