Skip to content

Instantly share code, notes, and snippets.

@rakibulinux
Last active February 15, 2020 09:26
Show Gist options
  • Save rakibulinux/c57b7cab8a5372a365c6dce6a023a895 to your computer and use it in GitHub Desktop.
Save rakibulinux/c57b7cab8a5372a365c6dce6a023a895 to your computer and use it in GitHub Desktop.
How to Install Node.js and npm on Ubuntu 18.04
#!/bin/sh
# Install Node JS & NPM Configure
# 1st Enable the NodeSource repository by running the following curl as a user with sudo privileges:
sudo apt install curl
curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
# 2nd Once the NodeSource repository is enabled, install Node.js and npm by typing:
# Run `sudo apt-get install -y nodejs` to install Node.js 12.x and npm
sudo apt-get install -y nodejs
# You may also need development tools to build native addons:
sudo apt-get install gcc g++ make
# To install the Yarn package manager, run:
curl -sL https://dl.yarnpkg.com/debian/pubkey.gpg | sudo apt-key add -
echo "deb https://dl.yarnpkg.com/debian/ stable main" | sudo tee /etc/apt/sources.list.d/yarn.list
sudo apt-get update && sudo apt-get install yarn
#Verify that the Node.js and npm were successfully installed by printing their versions:
node --version
npm --version
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment