NVM doesn't switch the expected Node.js version - node.js

I want to use an older version of Node.js in my application, and for that I have attempted to use nvm so that I can change the version accordingly.
Now I have three versions of Node.js and want to switch on specific version
nvm use [selected version]
It is successfully executed but the version is not updated
Example of use:

If your nvm command not updating your node version in windows, for example
Your current version is 6.11.2 and you would like to update to 8.11.3 using nvm use 8.11.3 in windows OS then below hack will do that job.
Renamed C:\Program Files\nodejs to C:\Program Files\nodejsx it worked for me.
Credit goes to user ituasdu

From the readme of NVM, under important notes:
Note: nvm does not support Windows (see #284). Two alternatives exist, which are neither supported nor developed by us:
nvm-windows
nodist

Related

Downgrade Node Js version

I want to downgrade the NodeJs version to 16 as some of the dependencies I am using in my React app do not support NodeJs 17. I tried this method (another post on stack overflow) also but this thing is not getting installed on my PC.
OS: Windows
Any sort of help is appreciated.
Thanks in advance.
You can use Node Version Manager(NVM).where you can downgrade or upgrade any node version. Please check
https://github.com/nvm-sh/nvm
Windows:
https://dev.to/skaytech/how-to-install-node-version-manager-nvm-for-windows-10-4nbi
Ubuntu:
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-20-04
Clearing the local installation of node, to find out where is and delete
where node
Install nvm
For Windows
For others
Show all the versions
nvm ls available
Install what you want
nvm install 16.11.0
nvm use 16.11.0
Check node version
node -v
I have tried several ways and this works, hope it helps.
2022 update with examples
Install nvm (See link readme: Windows uses installer, Linux has a CLI copy+paste bash script).
Restart the shell (if it was open when installed) to register the new path.
If you want 14.18.1, for example: nvm use 14.18.1
If you don't have it installed, it'll let you know. In that case: nvm install 14.8.1 -> repeat #3.
node -v to verify.
Nodejs.org has previous releases versions in their distribution directory. Find the node version you need and install it.
https://nodejs.org/dist/
n is the simplest package to manage your node versions.
https://www.npmjs.com/package/n

NVM doesn't update Node to the newest version

I'm using NVM (Node version manager) version 1.1.7 on Windows 10 to update Node through the Powershell terminal on VSCode. Today it occured to me that even though after updating and using nvm use 14.15.4 and getting 2 elevation dialogs and NVM telling me that it's now using the newest version, when I do nvm list or node -v or get-command node they're all still telling me that it uses an older version of Node.
After looking around for a bit some solutions said to add "runtimeExecutable": "/Users/*user*/.nvm/versions/node/*version*/bin/node" to the launch.json of VSCode, but that specific path doesn't even exist on my computer.
Check if nvm alias default <version> solves the problem

Visual Studio 2017 node version overrides nvm use version

I'm trying to learn Angular using asp.net core 2.0, since I have no experience with Node.js I'm trying to set up my environment using nvm, which I installed using chocolatey (just in case it makes a difference), as recommended by a friend, the tutorial I'm following tells me to use node 6.9.0 and have installed it and set it as active:
nvm install 6.9.0
nvm ls
nvm use 6.9.0
and I get the proper message telling me 6.9.0 is the active version. However when I do:
node --version
I get
v8.10.0
I use Visual Studio 2017 Pro for my everyday work, and I know it comes with its own version of node and I'm guessing that's what I'm seeing here and probably nvm will have no control over it as it not shown on the list of installed versions, and I know I haven't installed it myself. So my questions are:
What do I have to do to use the version I set with nvm?
Once I have that ready, what do I need to do to have VS use that version instead of its own?
I just worked out how to fix this, I'm posting an answer to help anyone else struggling with this, apparently, VS (or maybe myself :-( ) installed node directly and the one sitting on C:\Program Files\Nodejs was indeed version 8.10.0 and nvm was unable to change override it, so I just uninstalled the standalone node and ran the above commands on nvm and it worked like a charm.

I installed node.js v5.12.0 but the version showing v0.12.2

I installed Node.js from (https://nodejs.org/dist/latest-v5.x/node-v5.12.0-x64.msi), but the issue is , its showing version v0.12.2 instead of v5.12.0 which is required.
I try to update the node.js 5.2 installer but still showing version v0.12.2.
I have uninstalled Node.js and reinstall node-v5.12.0-x64.msi but still it’s not updated. Due to this am not able to run further commands for Ionic environmental setup.
Open a terminal and type where node
It should point to an old version of node (v0.12.2) still installed on your computer, for example C:\bin\node.
As Node.js is portable, you can have multiple versions on your computer.
If it cannot be uninstalled, simply delete C:\bin\node folder.
Then:
Open Windows System Properties/Advanced system properties
Click on Environment variables and edit PATH variable
Remove inside its value the path of the old version of node (C:\bin\node in our example).
Re-install Node v5.
Close your terminal and open a new one then type where node, it should point to Node.js v5
Most likely, you have an old Node version for x86 platform, and you are installing a newer version for 64 bit. Remove the path to the x86 from the Paths env variable, or move it to after the 64 bit path.
Solution:
List node.js installatios using nvm:
nvm ls
High chance the version you tried to install is also listed
Select the version to use using nvm
nvm use
(Not a direct solution)
You can try to install using nvm
Uninstall nodejs and follow the instruction from https://github.com/coreybutler/nvm-windows

How to backup my Node.js setup when upgrading

I want to upgrade Node.js on Ubuntu, but I want to make sure that if anything goes wrong I could revert back my source code, installed modules and node binary to the working setup. How to achieve that?
You can install any version of node.js just go to downloads. Go into Other Releases and download what version you want with respect to your OS and 32-bit or 64-bit.
Example:
node-vX.XX.X-OS-x64.tar.gz (64-bit)
node-vX.XX.X-OS-x86.tar.gz (32-bit)
Then, follow the instruction on the github.com. Building and installing Node.js
Another way is to use NVM, the Node Version Manager (it works in a very similar way to rvm for ruby). This allows to install and manage multiple versions of node. Here's a snippet (source):
Usage:
nvm install <version> Download and install a <version>
nvm use <version> Modify PATH to use <version>
nvm ls List versions (installed versions are blue)
You can also check this n. A Simple flavour of node binary management.
Update (as per comments):
If you have installed the nvm after node.js. You can check already installed by using nvm ls which lists already installed version(s) ready to use.
amolkulkarni#ubuntu:~$ nvm ls
current: v0.10.18
You should use Node Version Manager https://github.com/creationix/nvm

Resources