cli
cli copied to clipboard
docs(npm-install): explain package-lock.json behavior
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 installusespackage-lock.json" to thenpm installdocumentation - Explained the two scenarios:
- When
package.jsonandpackage-lock.jsonare in sync: exact versions from lockfile are installed - When they conflict:
package.jsonwins andpackage-lock.jsonis updated
- When
- Clarified that
package.jsonis the source of truth for version ranges, whilepackage-lock.jsonlocks to specific versions - Noted the relationship to
npm cibehavior
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