Semantic Versioning (semver) (Node.js)
Semantic Versioning (semver) is the MAJOR.MINOR.PATCH version scheme npm uses for packages. MAJOR breaks compatibility, MINOR adds features compatibly, and PATCH fixes bugs. Range symbols ^ and ~ control which updates npm accepts.
Node.js
A version like 4.18.2 reads as MAJOR.MINOR.PATCH. Bumping PATCH (4.18.3) means backward-compatible bug fixes; MINOR (4.19.0) means new features that do not break existing usage; MAJOR (5.0.0) signals breaking changes that may require code edits. This contract lets you update with predictable risk.
In package.json, range operators decide how far npm may upgrade. The caret ^4.18.0 allows any 4.x.x at or above 4.18.0 (minor and patch updates, no major). The tilde ~4.18.0 allows only patch updates within 4.18.x. An exact version 4.18.0 pins it precisely.
package-lock.json records the exact versions actually installed, so even with caret ranges everyone gets identical builds until you deliberately update. Pre-1.0 versions (0.x) are treated as unstable, where ^ behaves more conservatively because any change may break.
Syntax
"express": "^4.18.0" // MAJOR.MINOR.PATCHExamples
JavaScript
// dependency ranges in package.json
"dependencies": {
"express": "^4.18.0", // 4.x.x, >= 4.18.0
"lodash": "~4.17.21", // 4.17.x only
"left-pad": "1.3.0" // exactly 1.3.0
}