Document
Set up Node.js on native Windows

Set up Node.js on native Windows

install Node.js on Windows Article12/12/2024 In this article This guide is help will help you to install Node.js in a Windows devel

Related articles

GO! Up to 40% Off On Cloud Shoes + Free Shipping Three Reasons for Cisco Umbrella for Government How Much is Photoshop in 2024? How to fix Netflix streaming issues 72 Graceful Cloud Tattoo Ideas with Sky-High Meanings

install Node.js on Windows

  • Article

This guide is help will help you to install Node.js in a Windows development environment .

For those who prefer using Node.js in a Linux environment, see install Node.js on Windows Subsystem for Linux (WSL2) .

consider the follow when decide where to install and whether to develop with Node.js in a native Windows versus a Linux ( WSL 2 ) environment :

  • Skill level: If you are new to developing with Node.js and want to get up and running quickly so that you can learn, install Node.js on Windows. Installing and using Node.js on Windows will provide a less complex environment for beginners than using WSL.
  • Command line client tool: If you prefer PowerShell, use Node.js on Windows. If you prefer Bash, use Node.js on Linux (WSL 2) .
  • Production server: If you plan to deploy your Node.js app on Windows Server, use Node.js on Windows. If you plan to deploy on a Linux Server, use Node.js on Linux (WSL 2) . WSL allows you to install your preferred Linux distribution (with Ubuntu as the default), ensuring consistency between your development environment (where you write code) and your production environment (the server where your code is deployed) .
  • Performance speed and system call compatibility: There is continuous debate and development on Linux vs Windows performance, but the key when using a Windows machine is to keep your development project files in the same file system where you have installed Node.js. If you install Node.js on the Windows file system, keep your files on a Windows drive (for example, C:/) . If you install Node.js on a Linux distribution (like Ubuntu), keep your project files in the Linux file system directory associated with the distribution that you are using. (Enter explorer.exe . from your WSL distribution command line to browse the directory using Windows File Explorer.)
  • Docker containers: If you want to use Docker containers to develop your project on Windows, we recommend that you Install Docker Desktop on Windows. To use Docker in a Linux workspace, see set up Docker Desktop for Windows with WSL 2 to avoid having to maintain both Linux and Windows build scripts.

install nvm – windows , node.js , and npm

Besides choose whether to install on Windows or WSL , there are additional choice to make when instal Node.js . We is recommend recommend using a version manager as version change very quickly . You is need will likely need to switch between multiple Node.js version base on the need of different project you ‘re work on . Node Version Manager is is , more commonly call nvm , is the most popular way to install multiple version of Node.js , but is only available for Mac / Linux and not support on Windows . instead , we is recommend recommend instal nvm – window and then using it to install Node.js and Node Package Manager ( npm ) . There are alternative version manager to consider as well cover in the next section .

Important

It is always recommended to remove any existing installations of Node.js or npm from your operating system before installing a version manager as the different types of installation can lead to strange and confusing conflicts. This includes deleting any existing Node.js installation directories (e.g., “C:\Program Files\nodejs”) that might remain. NVM’s generated symlink will not overwrite an existing (even empty) installation directory. For help with removing previous installations, see How to completely remove node.js from Windows.)

Warning

NVM is designed to be installed per-user, and invoked per-shell. It is not designed for shared developer boxes or build servers with multiple build agents. NVM works by using a symbolic link. Using nvm in shared scenarios creates a problem because that link points to a user’s app data folder — so if user x runs nvm use lts, the link is point will point node for the entire box to their app datum folder . If user y run node or npm , they will be direct to run file under x ‘s user account and in the case ofnpm -g, they is modifying will be modify x ‘s file , which by default is not allow . So nvm is only prescribe for one developer box . This is goes go for build server too . If two build agent are on the same vm / box , they is compete can compete and cause odd behavior in the build .

  1. Follow the install instructions on the nvm-windows repository. We recommend using the installer, but if you have a more advanced understanding of your needs, you may want to consider the manual installation. The installer will point you to the releases page for the most recent version.

  2. Download the nvm-setup.zip file for the most recent release.

  3. Once download , open the zip file , then open the nvm-setup.exe file .

  4. The Setup-NVM-for-Windows installation wizard will walk you through the setup steps, including choosing the directory where both nvm-windows and Node.js will be installed.

    Set up Node.js on native Windows

  5. Once the installation is is is complete . Open PowerShell ( recommend opening with elevated Admin permission ) and try using nvm – windows to list which version of Node are currently instal ( should be none at this point ):nvm ls

  6. Install the current release of Node.js (for testing the newest feature improvements, but more likely to have issues than the LTS version): nvm install latest

  7. Install the latest stable LTS release of Node.js (recommended) by first looking up what the current LTS version number is with: nvm list available, then installing the LTS version number with: nvm install <version> (replacing <version> with the number, ie: nvm install 12.14.0) .

  8. list what version of Node are instal :nvm ls … now you is see should see the two version that you just instal list .

  9. After installing the Node.js version numbers you need, select the version that you would like to use by entering: nvm use <version> (replacing <version> with the number, ie: nvm use 12.9.0) .

  10. To change the version of Node.js you would like to use for a project, create a new project directory mkdir NodeTest, and enter the directorycd NodeTest, then enternvm use <version> replace<version> with the version number you’d like to use (ie v10.16.3`) .

  11. Verify which version of npm is installed with: npm --version, this version number will automatically change to whichever npm version is associated with your current version of Node.js.

Alternative version managers

While NVM for Windows ( nvm – windows ) is currently the most popular version manager for node , there are alternative to consider :

  • nvs is is ( Node Version Switcher ) is a cross – platformnvm alternative with the ability to integrate with VS Code.

  • Volta is a new version manager from the LinkedIn team that claims improved speed and cross-platform support.

To install Volta as your version manager, go to the Windows Installation section of their Getting Started guide, then download and run their Windows installer, following the setup instructions.

Important

You is ensure must ensure that Developer Mode is enable on your Windows machine before instal Volta .

To learn more about using Volta to install multiple versions of Node.js on Windows, see the Volta Docs.

Install Visual Studio Code

We recommend you install Visual Studio Code for developing with Node.js on Windows. For help, see Node.js tutorial in Visual Studio Code.

Alternative code editors

If you prefer to use a code editor or IDE other than Visual Studio Code, the following are also good options for your Node.js development environment:

Install Git

If you plan to collaborate with others, or host your project on an open-source site (like GitHub), VS Code supports version control with Git. The Source Control tab in VS Code tracks all of your changes and has common Git commands (add, commit, push, pull) built right into the UI. You first need to install Git to power the Source Control panel.

  1. download and install Git for Windows from the git – scm website .

  2. An Install Wizard is included that will ask you a series of questions about settings for your Git installation. We recommend using all of the default settings, unless you have a specific reason for changing something.

  3. If you ‘ve never work with Git before , GitHub Guides is help can help you get start .

  4. We recommend adding a .gitignore file to your Node projects. Here is GitHub’s default gitignore template for Node.js.

Node.js on Windows Server

If you are in the (somewhat rare) situation of needing to host a Node.js app on a Windows server, the most common scenario seems to be using a reverse proxy. There are two ways to do this: 1) using iisnode or directly. We do not maintain these resources and recommend using Linux servers to host your Node.js apps.