Skip to content

Instantly share code, notes, and snippets.

@cwsmith-160
Last active January 18, 2024 04:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cwsmith-160/e9c8ca80f23027f0495775aed77ec780 to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment