Search⌘ K

Node Package Manager(npm)

Explore how to use npm, the standard Node.js package manager, to initialize projects, install and update packages, and understand the structure and purpose of the package.json file. This lesson helps you manage dependencies and scripts effectively in full-stack web applications.

The npm package is the standard package manager for Node.js. This package is also used in the frontend to manage project dependencies.

How do we use npm?

First, we initialize the project and create a basic package.json file, like this:

npm init

If a package.json file already exists, we can install all the project dependencies by running this code:

npm install

To install a single package, we use the following code:

npm install <package_name>

To install a single package globally, we use the following code:

 ...