Installing Node.js & NPM

This tutorial gets your computer set up to install Node.js & NPM

What is Node.js and NPM

Quick Node.js Introduction

Node.js is the javascript engine that powers local use of javascript (not found in the browser). This allows the development of not only websites but also things like APIs and server side development using javascript as a language.

NPM Introduction

NPM is the package manager for node.js (stands for Node Package Manager), it allows users to manage all the packages that are installed both locally (within a directory) and globally (across the computer). You can consider this similar to pip for python

Installing Node.js

To install Node.js and NPM head over to the Node.js download page. This will install npm and node.js locally on your computer.

Please make sure that you add both to the PATH during installation

NPM Commands

Important NPM commands are primarily related to installation.

npm install

npm install is how we are able to install packages locally. This must be done in a directory where there exists a package.json

$ cd <directory with package.json>
$ npm install

npm install --global

Using the global flag installs specific packages globally and typically involves some form of a CLI that can be used to generate projects.

On Macs and Linux, in order to install anything globally, you must use sudo before so the result would be $ sudo npm install --global <package>

$ npm install --global <package-name>

Last updated