Skip to content

Instantly share code, notes, and snippets.

@cwsmith-160
Last active March 27, 2026 01:27
Show Gist options
  • Select an option

  • Save cwsmith-160/e9c8ca80f23027f0495775aed77ec780 to your computer and use it in GitHub Desktop.

Select an option

Save cwsmith-160/e9c8ca80f23027f0495775aed77ec780 to your computer and use it in GitHub Desktop.
How to install node/nodejs & npx

How to install Node.js (node/nodejs, npm, and npx) in different environments

Install nodejs on Windows with PowerShell

Check if any of the required components, Chocolatey package manager, Node Version Manager, or Node.js are already installed

choco -v
nvm -v
node -v
  • Install choco if neccassary: Invoke-WebRequest -Uri 'https://chocolatey.org/install.ps1' -Outfile 'install_chocolatey.ps1'
  • Install the Node Version Manager if neccassary: choco install nvm
  • Install node with nvm: nvm install latest

Test the installation

node -v
npm -v
npx -v

choco installs environment variables in the form of windows command shell variables e.g. %NVM_HOME%. node commands may need to be run from a command shell instead or the path variables may need to be modified.

Install nodejs on Linux Subsystem for Windows (Ubuntu)

    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/master/install.sh | bash
    nvm install --lts
@noctology
Copy link
Copy Markdown

Excellent tip and a small tip from me.

Tip

In secured Windows machines, you need to change the execution policy. If you an administrator, check it by running command below:

# Check current execution policy
Get-ExecutionPolicy

If output is:

Restricted

Run this:

Set-ExecutionPolicy RemoteSigned 
# Confirm the change
Get-ExecutionPolicy

One-liner to execute and leave things as they were:

powershell.exe -ExecutionPolicy Bypass -File .\install_chocolatey.ps1

@oleg620
Copy link
Copy Markdown

oleg620 commented Jan 23, 2026

Install choco if neccassary: Invoke-WebRequest -Uri 'https://chocolatey.org/install.ps1' -Outfile 'install_chocolatey.ps1'

This step is missing executing .\install_chocolatey.ps1

@Fabriciolimayt
Copy link
Copy Markdown

Yep this step is missing executing here too

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment