Installing Node.js Using nvm
- Windows
- Ubuntu
- macOS
Installing Node.js on Windows using a Node Version Manager (nvm) is a good way to manage multiple versions of Node.js on the same machine. Here is how you can do it:
Download and install the latest version of nvm for Windows from the official GitHub repository: https://github.com/coreybutler/nvm-windows
After the installation is complete, open a Command Prompt window and run the command
nvm list
to verify that nvm has been installed successfully and to see the list of available Node.js versions.To install the latest version of Node.js, run the command
nvm install latest
. This will download and install the latest version of Node.js.To install a specific version of Node.js, run the command
nvm install <version>
, where<version>
is the version number you want to install. For example,nvm install 12.16.3
To switch to a different version of Node.js, run the command
nvm use <version>
, where<version>
is the version number you want to switch to.To set a specific version of Node.js as the default version, run the command
nvm alias default <version>
, where<version>
is the version number you want to set as the default.Verify that Node.js has been installed by running the command
node -v
to see the version of Node.js that is currently in use.
By using nvm you can install multiple version of node.js and easily switch between them according to the project you are working on without the need to uninstall the previous version, this way you can test your code with different versions of node.js and make sure it's compatible with different version and environments.
Open a terminal window and run the following command to install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
After the installation is complete, open a terminal and run the command
nvm list
to verify that nvm has been installed successfully and to see the list of available Node.js versions.To install the latest version of Node.js, run the command
nvm install latest
. This will download and install the latest version of Node.js.To install a specific version of Node.js, run the command
nvm install <version>
, where<version>
is the version number you want to install. For example,nvm install 12.16.3
To switch to a different version of Node.js, run the command
nvm use <version>
, where<version>
is the version number you want to switch to.To set a specific version of Node.js as the default version, run the command
nvm alias default <version>
, where<version>
is the version number you want to set as the default.Verify that Node.js has been installed by running the command
node -v
to see the version of Node.js that is currently in use.
By using nvm you can install multiple version of node.js and easily switch between them according to the project you are working on without the need to uninstall the previous version, this way you can test your code with different versions of node.js and make sure it's compatible with different version and environments.
Open a terminal window and run the following command to install nvm:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.38.0/install.sh | bash
After the installation is complete, open a terminal and run the command
nvm list
to verify that nvm has been installed successfully and to see the list of available Node.js versions.To install the latest version of Node.js, run the command
nvm install latest
. This will download and install the latest version of Node.js.To install a specific version of Node.js, run the command
nvm install <version>
, where<version>
is the version number you want to install. For example,nvm install 12.16.3
To switch to a different version of Node.js, run the command
nvm use <version>
, where<version>
is the version number you want to switch to.To set a specific version of Node.js as the default version, run the command
nvm alias default <version>
, where<version>
is the version number you want to set as the default.Verify that Node.js has been installed by running the command
node -v
to see the version of Node.js that is currently in use.
By using nvm you can install multiple version of node.js and easily switch between them according to the project you are working on without the need to uninstall the previous version, this way you can test your code with different versions of node.js and make sure it's compatible with different version and environments.