Kinds of Package Managers

Language, OS and Application-Level Managers

Package managers work at three levels (1). An OS manager installs system software such as Node.js 2,131 for every user; a language manager installs libraries into one project; an application-level manager installs complete applications, bundled with their own libraries and often sandboxed.

The three levels of package manager
Level Examples Installs into Versions side by side
OS apt, apk, dnf, Homebrew 6,457 , winget 26,463 /usr, /opt, Program Files Usually one
Language npm 2,036 , Yarn 11,798 , pnpm 69,400 , Bun 73,307 , pip 21,050 , Cargo 6,602 The project folder Many, per project
Application Snap 2,571 , Flatpak 121,050 A sandboxed app tree Several channels

Trouble starts where levels meet. On this book's WSL2 6 Ubuntu 26.04 225 machine, dpkg-query -W nodejs reports 24.21.0-1nodesource1: Node.js came from NodeSource's apt repository, because Ubuntu's own archive carries Node.js 22.22.1. npm then installs BookNest's libraries on top. Keep each level in its own layer: never sudo npm install -g a project's libraries.