Tech

What is a Package Manager?

Published
Published:
Table of Contents

A package manager is a tool that installs and keeps track of the outside code your project uses. Instead of downloading libraries by hand and hoping for the best, you let the package manager do it cleanly.

Why it exists

Modern projects do not write everything from scratch. They use libraries that other people built. But managing those by hand is painful:

  • Which version do I need?
  • This library needs another library, which needs three more…
  • How do I give my project to a friend with all of this set up?

A package manager handles all of that for you.

The common ones

You have probably seen these:

  • npm for JavaScript
  • pip for Python
  • cargo for Rust
  • apt for installing software on Ubuntu Linux

They differ in details, but the idea is the same everywhere.

How it usually works

You ask for a library:

npm install react
pip install numpy

The manager downloads it, plus anything it depends on, and notes it down in a list file (like package.json or requirements.txt). Now anyone can recreate the exact setup with one command:

npm install

Dependencies and the famous joke

The libraries your project needs are called dependencies. Sometimes a tiny app ends up downloading hundreds of them, and people joke that the node_modules folder is the heaviest object in the universe. It is a joke, but if you have seen one, you are slowly nodding right now.

The takeaway

A package manager saves you from manually hunting, downloading, and version-matching code. Learn the one for your language early — it is one of the first tools that makes you feel properly productive.

Support this post Sponsor