How to Change the Version of Node.js in VS Code
Adam C. |

If you come to this post, then it's likely, you are scratching your head to find out why VS Code does not use the right version you pick.

Photo by Brett Jordan on Unsplash

There are many ways to install NodeJS, but the easiest way to do is using NVM. NVM is a great tool to manage different version of NodeJS installed on your computer. Either you want to upgrade to the latest NodeJS, or just switch from different versions as project needed, it comes in handy. But sometime it would be confused that you already use the version you pick in nvm, but VS Code is still using a different version. It's easy to fix only if you know how to.

In short, you need to make default version is the version you wanted.

For example, you have NodeJS V12 installed. Then to install NodeJS V14, and use it as default, what you need to do is the following:

nvm install v14
nvm use v14
nvm alias default v14 //the command to make v14 is the default

When you run nvm use v14 in VS Code, it will use V14 for the session, i.e., it will roll back to the default version after you restart the VS Code. To make V14 as default, then you have to run nvm alias default v14

Hope this helps!