Skip to content

Instantly share code, notes, and snippets.

@junibrosas
Created February 28, 2023 06:55
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 junibrosas/7628add7f0d58fa4126c0fa6b4e10343 to your computer and use it in GitHub Desktop.
Save junibrosas/7628add7f0d58fa4126c0fa6b4e10343 to your computer and use it in GitHub Desktop.
Run this script to install Node.js on the machine.
#!/bin/bash
# Check the latest version of NVM
curl https://github.com/nvm-sh/nvm/releases/latest | cut -d \/ -f 8 | cut -d \" -f 1
# Run the install script
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.37.0/install.sh | bash
# Paste in this scripts into your .bashrc or .bash_profile
export NVM_DIR="$HOME/.nvm"
[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"
[ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion"
# Install node and npm
nvm ls-remote
nvm install lts/hydrogen # Change the version according to your reference
nvm alias default lts/hydrogen
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment