Package Management
Lock File (package-lock.json)
What It Is
A file that records the exact versions of all installed packages
Analogy
A shopping receipt that lists exactly what you bought and from where
Try It Out
JSONpackage-lock.json
| 1 | { |
| 2 | 400">"name": 400">"my-project", |
| 3 | 400">"lockfileVersion": 3, |
| 4 | 400">"packages": { |
| 5 | 400">"node_modules/react": { |
| 6 | 400">"version": 400">"18.2.0", |
| 7 | 400">"resolved": 400">"https://registry.npmjs.org/react/-/react-18.2.0.tgz", |
| 8 | 400">"integrity": 400">"sha512-abc123..." |
| 9 | }, |
| 10 | 400">"node_modules/next": { |
| 11 | 400">"version": 400">"14.0.4", |
| 12 | 400">"resolved": 400">"https://registry.npmjs.org/next/-/next-14.0.4.tgz" |
| 13 | } |
| 14 | } |
| 15 | } |
Related Terms in Package Management
Package
A pre-made sauce you buy instead of making from scratch
Dependency
An ingredient your recipe requires — if it's missing, the dish won't work
npm (Node Package Manager)
A grocery store for JavaScript code — you tell it what you need, it gets it for you
npx
A rental car — use it once without buying it