'Installing different Node version in wsl 2

I am trying to update my Nodejs to the latest version in WSL 2. My old version is v15.0.0 and is installed at active : v15.0.0 at /home/sathish/.nvm/versions/node/v15.0.0/bin/node My new version installed : v18.1.0 to /usr/local/bin/node

My shell is using the old one. I don't know how to make my shell to use the new version. What should I do to make my shell use the new version installed at a different location?



Solution 1:[1]

You need to run

nvm use <your version>

Read more here: https://blog.logrocket.com/switching-between-node-versions-during-development/

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Lajos Arpad