{
 "kind": "tool",
 "slug": "semver-npm",
 "path": "tools/semver-npm/",
 "name": "semver (JavaScript)",
 "maker": null,
 "density": "full",
 "crumbs": [
  [
   "Tools",
   "tools/"
  ],
  [
   "Utilities",
   "tools/utilities/"
  ]
 ],
 "lead": "Compare and bump version numbers in JavaScript.",
 "chips": [
  {
   "label": "Utilities",
   "path": "tools/utilities/"
  },
  {
   "label": "NPM"
  }
 ],
 "primary": {
  "label": "Copy install command",
  "copy": "npm install semver"
 },
 "links": [
  {
   "label": "GitHub",
   "href": "https://github.com/npm/node-semver"
  },
  {
   "label": "Website",
   "href": "https://github.com/npm/node-semver#readme"
  }
 ],
 "track": "New versions, deprecation and license changes on your dashboard",
 "verdicts": [
  {
   "key": "license",
   "label": "License",
   "value": "ISC",
   "status": "yes",
   "sub": "Use it in paid apps",
   "quote": "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.",
   "note": "ISC allows any use, with or without fee.",
   "src": "https://github.com/npm/node-semver/blob/main/LICENSE"
  },
  {
   "key": "maint",
   "label": "Maintained",
   "value": "Maintained",
   "status": "yes",
   "sub": "Last change Nov 5, 2026",
   "note": "Latest GitHub release Nov 2, 2026. ",
   "src": "https://github.com/npm/node-semver"
  },
  {
   "key": "pop",
   "label": "Used by agents' projects",
   "value": "64 projects",
   "status": "info",
   "sub": "#21 of 406 in its category",
   "note": "Dependency in 64 public GitHub projects set up for AI coding agents that we scanned (1.0%).",
   "src": null
  },
  {
   "key": "agent",
   "label": "Agent access",
   "value": "Install only",
   "status": "info",
   "sub": null,
   "note": "Agent skills for this library in the skills catalog; community skills are written by others, read them before you install.",
   "src": null
  }
 ],
 "vfoot": "From the package registry and GitHub, checked daily; card checked Nov 10, 2026.",
 "blocks": [
  {
   "id": "overview",
   "nav": "Overview",
   "h2": "What semver (JavaScript) does",
   "parts": [
    {
     "t": "prose",
     "text": "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."
    },
    {
     "t": "h3",
     "text": "What people build with it"
    },
    {
     "t": "uses",
     "items": [
      {
       "title": "Stop when Node.js is too old",
       "text": "Your setup script checks the installed Node.js version first and stops with a clear message instead of failing later.",
       "idea": false
      },
      {
       "title": "Tell users an update is out",
       "text": "Your tool compares its own version with the newest one and says whether the update is a big or a small change.",
       "idea": false
      },
      {
       "title": "Pick the newest version that fits",
       "text": "From a list of published versions, choose the highest one that still matches the rule in your settings file.",
       "idea": false
      },
      {
       "title": "Work out the next release number",
       "text": "Before you publish, your release script computes the next patch, minor, major or beta number from the current one.",
       "idea": false
      },
      {
       "title": "Read versions from messy text",
       "text": "Pull a usable version out of strings like \"v3.4 replaces v3.3.1\" that other tools print.",
       "idea": false
      },
      {
       "title": "Check which plugins fit your app",
       "text": "Each plugin states the app versions it supports; your app loads only the plugins whose rule matches its own version.",
       "idea": true
      }
     ]
    }
   ]
  },
  {
   "id": "popularity",
   "nav": "Popularity",
   "h2": "semver (JavaScript) popularity",
   "parts": [
    {
     "t": "stats",
     "items": [
      {
       "n": "69",
       "of": "/ 100",
       "l": "Gid Score, #370 overall"
      },
      {
       "n": "1.19B",
       "l": "downloads a week, npm"
      },
      {
       "n": "5,475",
       "l": "GitHub stars"
      },
      {
       "n": "64",
       "l": "agent projects use it"
      }
     ]
    },
    {
     "t": "small",
     "text": "Gid Score measures public popularity and activity, not quality.",
     "link": "How the Gid Score is calculated",
     "path": "tools/top/"
    }
   ]
  },
  {
   "id": "usage",
   "nav": "How it is used",
   "h2": "How semver (JavaScript) is used",
   "parts": [
    {
     "t": "list",
     "items": [
      "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%)."
     ]
    },
    {
     "t": "h3",
     "text": "By coding agent"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "52 projects, 1.6%",
       "v": "Claude Code",
       "path": "agents/claude-code/"
      },
      {
       "l": "30 projects, 1.0%",
       "v": "GitHub Copilot",
       "path": "agents/github-copilot/"
      },
      {
       "l": "21 projects, 0.9%",
       "v": "Cursor",
       "path": "agents/cursor/"
      },
      {
       "l": "11 projects, 3.4%",
       "v": "OpenClaw",
       "path": "agents/openclaw/"
      },
      {
       "l": "10 projects, 2.2%",
       "v": "OpenAI Codex",
       "path": "agents/openai-codex/"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Often used with"
    },
    {
     "t": "rows",
     "rows": [
      {
       "l": "In 70.3% of its projects",
       "v": "Vitest",
       "path": "tools/vitest/"
      },
      {
       "l": "In 54.7% of its projects",
       "v": "tsx",
       "path": "tools/tsx/"
      },
      {
       "l": "In 45.3% of its projects",
       "v": "yaml",
       "path": "tools/yaml/"
      },
      {
       "l": "In 42.2% of its projects",
       "v": "chalk",
       "path": "tools/chalk/"
      },
      {
       "l": "In 42.2% of its projects",
       "v": "esbuild",
       "path": "tools/esbuild/"
      },
      {
       "l": "In 40.6% of its projects",
       "v": "ws",
       "path": "tools/ws/"
      },
      {
       "l": "In 37.5% of its projects",
       "v": "Model Context Protocol SDK (JavaScript)",
       "path": "tools/modelcontextprotocol/"
      },
      {
       "l": "In 90.6% of its projects",
       "v": "TypeScript",
       "path": "tools/typescript/"
      }
     ]
    }
   ]
  },
  {
   "id": "more",
   "nav": null,
   "spy_as": "usage",
   "h2": "More about semver (JavaScript)",
   "parts": [
    {
     "t": "more",
     "items": [
      {
       "title": "More in Utilities",
       "path": "tools/utilities/",
       "items": [
        {
         "text": "clsx",
         "path": "tools/clsx/"
        },
        {
         "text": "date-fns",
         "path": "tools/date-fns/"
        },
        {
         "text": "PyYAML",
         "path": "tools/pyyaml/"
        },
        {
         "text": "uuid",
         "path": "tools/uuid/"
        },
        {
         "text": "yaml",
         "path": "tools/yaml/"
        },
        {
         "text": "js-yaml",
         "path": "tools/js-yaml/"
        },
        {
         "text": "glob",
         "path": "tools/glob/"
        },
        {
         "text": "Lodash",
         "path": "tools/lodash/"
        }
       ]
      }
     ]
    }
   ]
  },
  {
   "id": "alternatives",
   "nav": "Alternatives",
   "h2": "Alternatives",
   "parts": [
    {
     "t": "alts",
     "items": [
      {
       "name": "semver (JavaScript)",
       "me": true,
       "facts": [
        "ISC",
        "Gid 69",
        "1.19B/wk"
       ]
      },
      {
       "name": "packaging",
       "why": "Pick packaging in Python projects; it parses Python package versions and version rules.",
       "path": "tools/packaging/",
       "facts": []
      },
      {
       "name": "semver (Python)",
       "why": "Pick the Python semver package when you need the same SemVer rules in Python code.",
       "path": "tools/semver-pypi/",
       "facts": []
      },
      {
       "name": "npm-check-updates",
       "why": "Pick npm-check-updates when you only want to find and apply newer versions in package.json, not write code.",
       "path": "tools/npm-check-updates/",
       "facts": []
      }
     ],
     "more": "Compare semver (JavaScript) with another tool",
     "more_path": "tools/compare/"
    }
   ]
  },
  {
   "id": "start",
   "nav": "Get started",
   "h2": "Get started",
   "parts": [
    {
     "t": "prompt",
     "text": "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."
    },
    {
     "t": "steps",
     "items": [
      {
       "text": "Add semver to your project.",
       "code": "npm install semver",
       "src": "https://github.com/npm/node-semver/blob/main/README.md"
      },
      {
       "text": "Load it and call the function you need.",
       "code": "const semver = require('semver')\n\nsemver.valid('1.2.3') // '1.2.3'\nsemver.valid('a.b.c') // null\nsemver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true\nsemver.gt('1.2.3', '9.8.7') // false\n",
       "src": "https://github.com/npm/node-semver/blob/main/README.md"
      }
     ]
    },
    {
     "t": "h3",
     "text": "Mistakes to avoid"
    },
    {
     "t": "mistakes",
     "items": [
      {
       "dont": "if (latest > current) with version strings",
       "fix": "semver.gt(latest, current) or semver.compare(a, b)",
       "why": "Plain string comparison says \"1.10.0\" > \"1.9.0\" is false (our run); semver compares the numbers."
      },
      {
       "dont": "semver.satisfies(\"1.9.0-beta.1\", \"^1.2.0\") and expecting true",
       "fix": "semver.satisfies(v, range, { includePrerelease: true }) when betas should count",
       "why": "Pre-releases are excluded from ranges by default; in our run the beta matched only with the flag."
      },
      {
       "dont": "Writing ^0.2.3 and expecting 0.3.0 to be accepted",
       "fix": "Use >=0.2.3 <1.0.0 if you really want every 0.x update",
       "why": "For 0.x versions the caret rule only allows patch updates."
      },
      {
       "dont": "semver.clean(\"~1.0.0\") or semver.valid(\"1.4\")",
       "fix": "semver.validRange(\"~1.0.0\") for rules; semver.valid(semver.coerce(\"1.4\")) for partial versions",
       "why": "clean() and valid() accept only full single versions; both returned null in our run."
      }
     ]
    }
   ]
  },
  {
   "id": "faq",
   "nav": "Questions",
   "h2": "Questions",
   "parts": [
    {
     "t": "faq",
     "items": [
      {
       "q": "What does a version number like 2.1.0 mean?",
       "a": "Under Semantic Versioning the first number goes up for breaking changes, the second for new features, the third for fixes.",
       "evidence": {
        "url": "https://semver.org/",
        "quote": "MAJOR version when you make incompatible API changes"
       }
      },
      {
       "q": "Does it accept versions written as v1.2.3?",
       "a": "Yes. A leading v or = is stripped before the version is read.",
       "evidence": {
        "url": "https://github.com/npm/node-semver/blob/main/README.md",
        "quote": "A leading \"=\" or \"v\" character is stripped off and ignored."
       }
      },
      {
       "q": "Why does 1.9.0-beta.1 not match ^1.2.0?",
       "a": "Pre-release versions are left out of rules by default; pass { includePrerelease: true } to count them.",
       "evidence": {
        "url": "https://github.com/npm/node-semver/blob/main/README.md",
        "quote": "includePrerelease: Set to suppress the default behavior of excluding prerelease tagged versions from ranges unless they are explicitly opted into."
       }
      },
      {
       "q": "Can it clean up a rule like ~1.0.0?",
       "a": "No. clean() works only on single versions; for rules use validRange().",
       "evidence": {
        "url": "https://github.com/npm/node-semver/blob/main/README.md",
        "quote": "This does not work for ranges."
       }
      }
     ]
    }
   ]
  }
 ],
 "glance": [
  [
   "Package",
   "npm semver"
  ],
  [
   "Category",
   "Utilities"
  ],
  [
   "License",
   "ISC"
  ],
  [
   "Gid Score",
   "69.3"
  ],
  [
   "Rank in category",
   "#21 of 406"
  ],
  [
   "GitHub",
   "npm/node-semver"
  ],
  [
   "Last change",
   "Nov 5, 2026"
  ]
 ],
 "good": [
  "Beta and release-candidate versions are skipped by version rules unless you ask for them.",
  "For versions starting with 0, the caret rule ^0.2.3 allows only 0.2.x updates, not 0.3.0.",
  "The forgiving reader keeps only the first three numbers, so 4.6.3.9.2 becomes 4.6.3."
 ],
 "checked_line": "Read by AgentGid from 8 official pages, card checked Nov 10, 2026; numbers update daily.",
 "logo": "https://agentgid.com/media/avatars/npm.png"
}