DEV Community

Rae Liu
Rae Liu

Posted on • Updated on

How to setup node.js application on Windows

If you are a Mac user, then Homebrew is the best way to add packages.

But if you have a Windows machine, then there are two package managers that I recommend Chocolatey or Scoop.

Chocolatey (with LTS version)

  1. Run Windows Powershell as administrator
  2. Run command
Set-ExecutionPolicy Bypass -Scope Process -Force; iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'))
Enter fullscreen mode Exit fullscreen mode
  1. Reopen the Powershell
  2. Install the LTS version
choco install nodejs-lts --version=VERSION_NUMBER
Enter fullscreen mode Exit fullscreen mode
  1. Reopen the Powershell, and run the command below to test
node -v
Enter fullscreen mode Exit fullscreen mode

Scoop (with nvm)

  1. Run Command Prompt or Windows Powershell as administrator
  2. Run command
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('https://get.scoop.sh')
Enter fullscreen mode Exit fullscreen mode
  1. Reopen the powershell
  2. Install nodejs package and nvm
scoop install nodejs nvm
Enter fullscreen mode Exit fullscreen mode
  1. install node version and use it
nvm install VERSION_NUMBER
nvm use VERSION_NUMBER
Enter fullscreen mode Exit fullscreen mode
  1. Repoen the Powershell, and test by using command
node -v
Enter fullscreen mode Exit fullscreen mode

If you have an error to install Chocolatey or Scoop

Please check the execution policy on Powershell.

Chocolatey

Set-ExecutionPolicy AllSigned
Enter fullscreen mode Exit fullscreen mode

or

Set-ExecutionPolicy Bypass -Scope Process
Enter fullscreen mode Exit fullscreen mode

Scoop

Set-ExecutionPolicy RemoteSigned -scope CurrentUser
Enter fullscreen mode Exit fullscreen mode

Discussion (1)

Collapse
vegasbrianc profile image
Brian Christner

Awesome. thanks for these tips. Helped a ton fix some Docker issues I was having installing node in windows