npm Explained: The Package Manager Behind JavaScript
Introduction Almost no JavaScript project is written from scratch: you build on libraries — React, Express, lodash — written by other people. npm (Node Package Manager) is how those libraries reach your project: it is both the world's largest software registry (millions of packages) and the command-line tool that installs and manages them. If you use Node.js (the Node.js post), you already have npm. Install: dependencies, and where they live Installing a package is one command: npm install react That downloads React into node_modules/ and records it in package.json, the manifest every JavaScript project carries: { "dependencies": { "react": "^18.2.0" } } The caret means "compatible updates allowed" — version 18.3 is fine, 19.0 is not. Development-only tools (test runners, linters like ESLint) go in devDependencies instead, so production installs skip them. And node_modules/ itself is never committed to Git — it can contain tens...