1. License
“Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.”
ISC allows any use, with or without fee.
github.com/npm/node-semver/blob/main/LICENSE3. Used by agents' projects
Dependency in 64 public GitHub projects set up for AI coding agents that we scanned (1.0%).
4. Agent access
Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.
From the package registry and GitHub, checked daily; card checked Nov 10, 2026. Tap a verdict to see its source.How we checkedReport an error
What semver (JavaScript) does
semver is a small free JavaScript library that understands version numbers like 1.4.2 and rules like "1.2 or newer, but not 2". Your app or script can tell which version is newer, whether a version fits a rule, and what the next version number should be. It is the same version logic npm itself uses.
What people build with it
Stop when Node.js is too old
Your setup script checks the installed Node.js version first and stops with a clear message instead of failing later.
Tell users an update is out
Your tool compares its own version with the newest one and says whether the update is a big or a small change.
Pick the newest version that fits
From a list of published versions, choose the highest one that still matches the rule in your settings file.
Work out the next release number
Before you publish, your release script computes the next patch, minor, major or beta number from the current one.
Read versions from messy text
Pull a usable version out of strings like "v3.4 replaces v3.3.1" that other tools print.
Check which plugins fit your app Idea
Each plugin states the app versions it supports; your app loads only the plugins whose rule matches its own version.
semver (JavaScript) popularity
Gid Score measures public popularity and activity, not quality. How the Gid Score is calculated
How semver (JavaScript) is used
- semver (JavaScript) is a dependency in 64 of the 6,254 public GitHub projects set up for AI coding agents that we scanned (1.3% of the 4,863 JavaScript/TypeScript ones), #21 of 406 in utilities.
- Counting the projects our scan samples by dependency (Solana 3,063, Ethereum and EVM 1,777, 3D and games 3,120, agent frameworks and SDKs 13,629), it appears in 220; those are left out of every share on this page.
- Projects that use it most often also use Vitest (70.3%), tsx (54.7%), yaml (45.3%).
By coding agent
Often used with
More about semver (JavaScript)
Alternatives
semver (JavaScript) This page
Pick packaging in Python projects; it parses Python package versions and version rules.
Pick the Python semver package when you need the same SemVer rules in Python code.
Pick npm-check-updates when you only want to find and apply newer versions in package.json, not write code.
Get started
Tell your AI assistant
“Use the npm package semver (pin semver@7.8.6, Node.js 10+) for every version comparison in this project: semver.gt/compare instead of string comparison, semver.satisfies for ranges, and semver.inc to compute the next release number.”
Load it and call the function you need.
const semver = require('semver') semver.valid('1.2.3') // '1.2.3' semver.valid('a.b.c') // null semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true semver.gt('1.2.3', '9.8.7') // false
Mistakes to avoid
Plain string comparison says "1.10.0" > "1.9.0" is false (our run); semver compares the numbers.
Pre-releases are excluded from ranges by default; in our run the beta matched only with the flag.
For 0.x versions the caret rule only allows patch updates.
clean() and valid() accept only full single versions; both returned null in our run.
Questions
What does a version number like 2.1.0 mean?
Under Semantic Versioning the first number goes up for breaking changes, the second for new features, the third for fixes.
Does it accept versions written as v1.2.3?
Yes. A leading v or = is stripped before the version is read.
Why does 1.9.0-beta.1 not match ^1.2.0?
Pre-release versions are left out of rules by default; pass { includePrerelease: true } to count them.
Can it clean up a rule like ~1.0.0?
No. clean() works only on single versions; for rules use validRange().