When you install Node, it comes bundled with NVM, which is the Node Version Manager. It allows you to install multiple versions of Node and switch between them.
To check if you have NVM installed, run the following command:
BASH
nvm --version
Sometimes, when you run this command, you might get:
BASH
command not found: nvm
In this post, we'll learn how to fix this error in Node.
How to fix command not found: nvm
As mentioned before, to double-check that you have NVM installed, you can run the following command:
BASH
nvm --version
If it goes well, you should get back a version number, but if not, you might get command not found: nvm.
The reason for this is that NVM is not in your PATH.
To fix this, open up your /.bashrc file and add the following line:
BASH
export NVM_DIR="$HOME/.nvm"
This will set the NVM_DIR variable to the location of your NVM installation.