Reputation: 171
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?
Upvotes: 5
Views: 3498
Reputation: 1
You can run this
nvm install --lts
This command automatically installs a new stable node.js version and set that version globally
Upvotes: 0
Reputation: 171
I just uninstalled all versions and then reinstalled. It works now. Thanks for the answer.
Upvotes: -1
Reputation: 11
the simplest solution you should install nvm then using that install the latest version of node then change the default to the newest version https://www.codegrepper.com/code-examples/whatever/set+default+node+version+ubuntu+nvm
Upvotes: 1
Reputation: 76414
You need to run
nvm use <your version>
Read more here: https://blog.logrocket.com/switching-between-node-versions-during-development/
Upvotes: 2