Commit 5552e46
docs(npm-install): explain package-lock.json behavior (#8797)
## Description
This PR adds documentation explaining how `npm install` behaves with
respect to `package.json` and `package-lock.json`, a common source of
confusion for npm users.
## Changes
- Added a new section "How `npm install` uses `package-lock.json`" to
the `npm install` documentation
- Explained the two scenarios:
- When `package.json` and `package-lock.json` are in sync: exact
versions from lockfile are installed
- When they conflict: `package.json` wins and `package-lock.json` is
updated
- Clarified that `package.json` is the source of truth for version
ranges, while `package-lock.json` locks to specific versions
- Noted the relationship to `npm ci` behavior
## Context
The npm install documentation previously didn't explain how it handles
the interaction between `package.json` and `package-lock.json`. Users
were confused about when versions from the lockfile are used versus when
they're updated. This PR incorporates the explanation from Kat Marchán
that was referenced in the issue to provide clear guidance.
Closes #4866
Co-authored-by: Max Black <husivm@google.com>1 parent c2f784d commit 5552e46
1 file changed
+12
-0
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
22 | 34 | | |
23 | 35 | | |
24 | 36 | | |
| |||
0 commit comments