For a new project I needed to have Node 14 running on my Windows 10 machine, so installation was done quickly via downloading and running the setup file.
A short time later I wanted to write a new blog post here on kiko.io, which depends on the Node.js based static site generator Hexo … and ran into several problems.
First of all my hero image processing script (see Automatic Header Images in Hexo) returned an exception. The script uses hexo-fs and the problem is known quite some time, according to this Github issue. The guys recommend to downgrade to an older version of Node.js … :(
Ok … I needed a solution to install multiple Node.js versions and switch between them, depending on which project I want to work on … and there is one: nvm-windows by Corey Butler!
The setup is pretty straight forward and asks you at the very end, if the currently installed Node.js version should be managed by it. Confirmed…
There are just a few commands to know and to run in the command line:
List available Node.js versions
nvm list available
Install needed Node.js version
nvm install <version>
Switch to particular Node.js version
nvm use <version>
List all installed Node.js versions
In case you have Node.js version dependend utilities installed globally, you need to run
npm install -g after switch.
- Github: coreybutler/nvm-windows
- Microsoft Docs: Set up your Node.js development environment directly on Windows