Skip to content

Instantly share code, notes, and snippets.

@sen0rxol0
Last active June 10, 2019 18:43
Show Gist options
  • Save sen0rxol0/a1407098f9bb7a33c30097ae33d020cf to your computer and use it in GitHub Desktop.
Save sen0rxol0/a1407098f9bb7a33c30097ae33d020cf to your computer and use it in GitHub Desktop.
Reinstalling NodeJS on debian/ubuntu

NodeJS installation on terminal

  sudo apt install build-essentials -y
  
  ## Remove any old repositories/PPA
  ## add-apt-repository may not be present on some Ubuntu releases:
  # sudo apt-get install python-software-properties
  sudo add-apt-repository -y -r ppa:chris-lea/node.js
  sudo rm -f /etc/apt/sources.list.d/chris-lea-node_js-*.list
  sudo rm -f /etc/apt/sources.list.d/chris-lea-node_js-*.list.save
  ## Add nodesource signing key
  curl -sSL https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add -
  # wget can also be used:
  # wget --quiet -O - https://deb.nodesource.com/gpgkey/nodesource.gpg.key | sudo apt-key add 
  # Replace with the branch of Node.js or io.js you want to install: node_6.x, node_8.x, etc...
  VERSION=node_8.x
  DISTRO="$(lsb_release -s -c)"
  echo "deb https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee /etc/apt/sources.list.d/nodesource.list
  echo "deb-src https://deb.nodesource.com/$VERSION $DISTRO main" | sudo tee -a /etc/apt/sources.list.d/nodesource.list
    ## Update package list and install nodejs
    sudo apt-get update
    sudo apt-get install -y nodejs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment