Skip to content

Instantly share code, notes, and snippets.

@BjornW
Last active November 29, 2017 20:18
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 BjornW/5e40a7bdca2620e262ff6f9ffb42385d to your computer and use it in GitHub Desktop.
Save BjornW/5e40a7bdca2620e262ff6f9ffb42385d to your computer and use it in GitHub Desktop.
Install npm on Ubuntu 16.04

I'm installing the current LTS release of nodejs and npm, which is v8.9.1 and 5.5.1 on Ubuntu 16.04 LTS

  1. Download the setup script: https://deb.nodesource.com/setup_8.x and make sure you understand what it does before continuing...
  2. Chmod +x the setup script to make it an executable. Mine is called setup_8.x and I have renamed it setup_8.x.sh
  3. Run the script with sudo, it will add another repository to your sources.list.d and update apt's cache.
  4. Install the nodejs packages as the script states using: sudo apt-get install nodejs
  5. Type nodejs --version to get your nodejs version and type npm -v to get your npm version.

If all went well it should be similar to mine.

Note: I recommend to never use Curl or Wget to automagically download and run a script. It's a bad idea since you do not know what the script will do. So please make sure you understand what you're doing before running a script of the Internet ;)

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