How to update NodeJS to the latest version without uninstalling the existing one?
meda Changed status to publish 16/07/2022
There are a couple of ways to update NodeJS to the latest version. One of the easiest way is:
- sudo npm cache clean -f // this clears the npm package cache
- sudo npm install -g n // install n module to manage NodeJS versions
- sudo n latest or sudo n stable // install the latest node version or the stable based your requirement
- hash -r //reset the bash if the old node version is still there
Note: I tested it on Ubuntu
the_reactor Answered question 23/02/2022