After coming back to work from vacation, I learned that our frontend codebase’s dependency has been updated and it was necessary to have NodeJS with version higher than 18. My previous NodeJS version was 14.x.x. I was using nvm
before to change NodeJS version on my machine.
What is nvm
?
nvm
is Node Version Manager which allows us to install and use different versions of NodeJS via the command line.
To install specific NodeJS version
nvm install 18
Now using node v18.16.0 (npm v9.5.1)
To use specific NodeJS version
nvm use 18
Now using node v18.16.0 (npm v9.5.1)
To uninstall specific NodeJS version
nvm uninstall 18
Uninstalled node v18.16.0
Problem of not being able to use the new NodeJS version
Although I’ve done the above steps to install and use the new version, my NodeJS version still stayed the same as previous.
Solution
rm `which node`
This has allowed me to remove NodeJS installed on my machine completely and I was able to install and use the newer version I want.
I found out later that there’s a command nvm cache clear
as well.