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:
Recent Comments