We recommend NVM for Windows to easily install, update and manage Node.js on our machines instead of directly installing it. As an added bonus, it allows you to switch between Node.js versions in a matter of seconds. If you’re on Linux, please follow this guide.
- You can proceed with this guide if you need to perform a migration from an existing Node.js installation in this case, click here, or if you don't need to to perform any migration, skip to the section on setting up Node.js with NVM for Windows, click here.
- Alternatively, you can install Node.js via its installer directly (we recommend the latest LTS version) and skip down to the Additional Configuration. However, we recommend against trying to maintain a Node.js installation this way.
- Optional: Backup any global
npmrc
config, e.g. %AppData%\npm\etc\npmrc. Alternatively, copy the settings to the user config %UserProfile%\.npmrc. - Uninstall Node.js via Add or Remove Programs.
- Delete the Node.js installation directory %ProgramFiles%\nodejs by hand, should it remain.
- Using PowerShell: rmdir -r "$env:ProgramFiles\nodejs".
- Delete the NPM cache usually located in %AppData%\npm.
- Using PowerShell: rmdir -r "$env:AppData\npm".
- Go to the next section.
- Close all Visual Studio instances.
- Install the latest release of NVM for Windows.
- Use the nvm-setup.exe from the list of assets.
- If your user folder contains accented characters or spaces, then in the installer wizard select a different path as the NVM installation location, which is free of those characters. Otherwise,
nvm
commands will fail later on. - Open a new PowerShell window (or your favorite shell). Note: If you had a shell window open before running the NVM installer, it might not recognize the new
nvm
commands. Open a new window. - Run
nvm install lts
. This will install the latest LTS version of Node.js. - Run
nvm use lts
. This will activate the latest LTS version of Node.js as the current version. - Should you need any other version of Node.js, e.g. for a certain client, run
nvm list available
, pick the desired version, and runnvm install
andnvm use
with that version. - Skip down and follow Additional Configuration section.
- You need to enable long paths to support the deep directory structure PNPM generates (after setting the long paths key, a reboot is necessary for the changes to take effect).
- Visual Studio users should add the Node.js installation path to the list of "External Web Tools" to ensure VS uses the same version that's used from the command line. To configure this:
- Start Visual Studio without opening any solution.
- Open Tools → Options → Projects and Solutions → Web Package Management → External Web Tools.
- Add C:\Program Files\NodeJs to the list and move it to the top.
- Install the NPM Task Runner extension for Visual Studio to execute any project’s node scripts, defined in their respective package.json, from the Task Runner Explorer window.