Install Node.js on Windows

How to Install Node.js on Windows?

The most common and simplest method to install Node.js on Windows is downloading and running Node.js Installer from the official Node.js website and following prompts in the Node.js Setup Wizard. The installer allows you to add Node.js to your system path and access it from the command prompt or PowerShell.

Installing Node.js as a cross-platform runtime environment, allows you to run JavaScript code on the server side for efficient, full-stack, and cross-platform development. Level up your Windows server to an efficient development environment for building high-performance network applications written in JavaScript.

Requirements for installing Node.js on Windows

To smooth Node.js installation on Windows, you need to meet some requirements and prerequisites:

  • High-performance Windows VPS with Windows 10 or later version.
  • user account with administrator privilege
  • At least 4GB RAM for smooth development work.
  • At least 10GB of free disk space
  • Using modern processor

Comprehensive Guidelines to Install Node.js on Windows

Here are steps to install Node.js on a Windows server for empowering your Windows server:

Method 1: Install Node.js and NPM on Windows using Node.js Installer

1. Go to the official Node.js download page and download the appropriate installer for your system (LTS versions are recommended) by clicking the Windows installer button under the desired LTS version.

Install Node.js on Windows using official Node.js Installer

2. After downloading the installer, Double-click the downloaded .msi installer file which is saved in the Downloads folder by default to launch the installer.

3. Node.js Setup Wizard will appear to guide you through the setup process.

4. After clicking Next, read and accept the End-user license agreement by clicking the checkbox next to “I accept the terms in the License Agreement” and hit the “Next” button to proceed.

install Node.js on Windows by following prompts of Node.js setup wizard

install Node.js on Windows by following prompts of Node.js setup wizard

5. Choose the destination folder where you want to install Node.js (default location is usually recommended) and click “Next” to continue.

specify destination where you want to install Node.js on Windows

6. Select default options to include from installation (like npm, node, online documentation shortcuts, etc), then click “Next“.

Select default features to include from installation and click Next to complete Node.js installation

7. You can customize the setup by choosing a checkbox to install additional tools for native modules development (Like, Python, Visual Studio Build Tools, and Chocolatey) and hit “Next“.

Install Node.js on Windows 0 6

8. Click “Install” to begin the installation process and wait for the downloading and configuring necessary files to finish.

Click "Install" to begin the Node.js installation on Windows

9. When the installation process is complete, click “Finish“.

click Finish to complete Node.js installation on Windows

10. If you have selected to install native tools after closing the installer the PowerShell script automatically starts to install selected tools (such as Chocolatey).

11. To verify Node.js installed successfully, open Command Prompt (press Win + R, type cmd, and press Enter) and type the following commands:

node -v
npm -v

If the output displays installed Node.js and NPM versions, you can ensure the installation was successful.

Congratulations! You’ve successfully installed Node.js on your Windows server using the official installer.

Note: If the output includes the error message “Command not found“, that means npm or Node was not installed.

Additional Tips:

  • It is highly recommended to install additional tools along with Node.js installation because they are useful for specific projects and there is no harm in installing them.
  • Node.js installation includes installing npm which is Node Package Manager and a useful tool.
  • To verify the npm installation, you can run the ” npm -v ” command.
  • To update npm to the latest version, run the ” npm install -g npm ” command.
  • Set up Environment Variables (if needed) via selecting Start menu > typing “env” > selecting “Edit the system environment variables“> clicking “Environment Variables” > “Path” variable > “Edit” > “New” > adding the path to the Node.js installation.
  • Installing a good Code Editor such as Visual Studio Code is beneficial for Node.js developers.

Method2: Install Node.js and NPM on Windows using Chocolatey

You can install Node.js and NPM (Node Package Manager) using Chocolatey which is a popular package manager for Windows. Chocolatey allows you to install Node.js through a single command. It also simplifies updates and uninstalls packages. Let’s start to install Node.js on the Windows system with Administration access:

1. Equip your Windows server with Chocolatey by installing Chocolatey on Windows through Command Prompt or PowerShell.

2. Open Command Prompt or PowerShell with administrator privileges and run the following command to install the latest version of Node.js via Chocolatey:

choco install nodejs

3. To install a specific version of Node.js on a Windows system, you can specify the version number, for example, to install Node.js version 20.14.0 run the following command:

choco install nodejs --version=20.14.0

4. Accept the installation script prompt by pressing Y and Enter.

5. During installation, you are prompted to accept the license agreements for Node.js and any dependencies.

6. Verify Node.js and npm installation by running the following command and receiving the installed Node.js version:

node -v
npm -v

If the output displays the installed Node.js version, that means you have installed Node.js on Windows servers successfully using Chocolatey.

Additional Notes:

  • If you want to upgrade Node.js to the latest version using Chocolatey, run the command ” choco install nodejs “.
  • If you need to uninstall Node.js later, run the command ” choco uninstall nodejs “.

Method3: Install Node.js and NPM on Windows using nvm-windows

The nvm (Node Version Manager), is a useful tool to install, uninstall, and manage multiple versions of Node.js on your Windows system, which is another method to install Node.js on a Windows server that offers greater flexibility. This method is more advanced but it is beneficial for projects that require different Node.js versions. Here are steps to install Node.js and NPM via nvm-windows:

1. Download the latest version of nvm for Windows by referring to the GitHub repository and clicking the “Download Now!” button.

install Node.js on Windows by downloading the latest version of nvm for Windows

2. Double-click the downloaded nvm-setup.exe file to run the nvm-windows Installer.

3. Follow the wizard prompts to complete the installation process and close the wizard window once the installation finishes.

4. Open the new Command Prompt or PowerShell window (by pressing “Win + R” and typing “cmd” or “PowerShell“) while any existing command prompt or PowerShell windows are closed.

5. Verify nvm-installation by running the following command and receiving the installed nvm-windows version:

nvm -v

6. To see the list of available Node.js versions to install, run the following command:

nvm list available

7. After checking available Node.js versions, it is time to install a specific version of Node.js on your Windows system:

nvm install <version>

For example:

nvm install 20.14.0

8. If you have installed multiple Node.js versions, to set a specific Node.js version to use, run the following command:

nvm use <version>

9. Verify Node.js installation using the following command:

node -v

The output should display the correct version of Node.js you installed.

Additional Tips:

  • It is recommended to install the latest LTS (Long-Term Support) version of Node.js.
  • To uninstall a specific Node.js version using nvm-windows run the command ” nvm uninstall <version> “.
  • To list installed Node.js versions using nvm run the command ” nvm list “.
  • To install the latest stable version of Node.js you can also use the commands ” nvm install node ” or ” nvm install latest “.
  • When installing Node.js using nvm, you have installed npm as well, so you can verify npm installation by running command ” npm -v “.

Test Node.js installation

To check and confirm that Node.js and npm are correctly installed and functioning on your Windows server, the simplest way is clicking Windows start icon and search for node.js.

You can see the node.js folder that has been created, so click on it and select the Node.js command prompt to launch it.

Write “node” and press enter:

node

You should see “Welcome to Node.js with its version”.

Test Node.js installation on Windows server

Or, you can run a simple Node.js Script. Open the Command prompt or PowerShell, and create a new file named “test.js” with the following content:

console.log('Node.js is working!');

Save the file.

Navigate to the directory that includes “test.js” in Command Prompt or Powershell and execute the script using the following command:

node test.js

If this command prints ” Node.js is working! “, it means Node.js is working fine on your Windows system.

Note: When writing messages to the console, pay attention to parenthesis and semicolon.

Conclusion

Congratulations, by installing Node.js on your Windows system, you have empowered your Windows server as an optimal development platform for Node.js JavaScript programs. Node.js will prepare your Windows system for developing web servers, real-time applications, APIs, and other server-side applications.

Leave a Reply

Your email address will not be published. Required fields are marked.