When I started working with Python, *args was very handy and I started to miss it in my Javascript projects. Only recently, I found out you can get an arguments object of the function’s arguments like this:
At my day job we work with Node 12 for our projects, but I wanted to check out NuxtJS 3, which requires version 14 or 16. Once I updated npm, I found out me old projects no longer worked properly. Reinstalling node_modules didn’t solve the problem, and besided, I didn’t want to saddle up my colleagues with version incompatibilities I couldn’t detect myself. So, I looked into finding a solution. And found one!
With n you can switch easily between Node versions. To install:
Don’t install it as root, that will make it much more annoying to work with.
Now it is easy to change between versions:
n 16
node -v
>> v16.13.1
n 14
node -v
>> v14.18.2
But still, you would have to remember which version is used in which project. That’s not fun at all, so that’s what avn was made for. I guess I’m not the only one who is annoyed by such things.
To install avn:
npm install -g avn avn-nvm avn-n
avn setup
That last command adds a line to ~/.bash_profile, which is ignored in my setup, so I had to move that line to ~/.bashrc :
n 10.13.0 # Install node version 10.13.0 by n
rm -R ~/.avn
nvm exec 10.13.0 npm install -g avn avn-nvm avn-n # Use installed version to install the packages
nvm exec 10.13.0 avn setup
This only works with already installed node versions. When I went to a directory with a node version that isn’t installed yet, I got this:
My current solution is to just install that version manually with n:
Copyleft: These days everything you can think of is copyrighted, patented, protected or otherwise made into someone's imaginary intellectual property. I have a lot of imagination but not enough to pretend that I have some divine right to share things with you without giving you the right to share it further. That would be childish. So, everything here is licensed under a Creative Commons Attribution-Noncommercial-Share Alike license. That means that you can bloody well do anything you like with my content as long as you tell that it's from me (or the respective author). Only if you want to make money from my content do you have to ask me permission first. (As if I could be bothered to sue.) Oh, and you can't redistribute your derivative content under more restrictive terms. Share the love.
Colophon: This weblog is powered by a WordPress installation running on PHP5 and MySQL, hosted by NearlyFreeSpeech.Net's outstanding FreeBSD hosting platform. The markup for this WP theme is my own and should usually validate as some sort of XHTML concoction. So should the CSS. I've actually blogged about this theme.
Recent Comments