Skip to content

Node.js Basics

Installing Node.js and npm on Ubuntu

sudo apt install nodejs npm

Starting a Project

npm init

The argument -y can be used to skip the setup prompt and create a packages.json boilerplate.

npm init -y

Downloading Packages Using npm

Download Packge from Registry

npm install <package-name>
Sample
npm install jshint

Download Package Hosted on GitHub

npm install <github/project>
Sample
npm install mozilla/readability

Installing Packages Globally

npm install -g <package>