Skip to content

Package Managers

This content is for Backend. Switch to the latest version for up-to-date documentation.

A Package Manager is a tool that automates the process of installing, upgrading, configuring, and removing software packages (libraries) in your project.

Focus Topic

npm is the default package manager for Node.js. It is the world’s largest software registry.

When you install Node.js, you get npm automatically.

  • npm init: Sets up a new project (creates package.json).
  • npm install <package-name>: Downloads a library and adds it to your project.
  • npm start: Runs the start script defined in your package file.
Diagram
  • package.json: The manifest file. It lists your project’s name, version, and dependencies.
  • node_modules: The folder where the actual code of the downloaded packages lives. Do not edit files here!
  • package-lock.json: Ensures everyone on your team installs the exact same versions of packages.
  • yarn: Created by Facebook to be faster and more secure than npm (though npm has caught up).
  • pnpm: “Performant npm”. It saves disk space by using a shared store for packages, so you don’t have duplicates on your computer.
Built with passion by Ngineer Lab