{"id":17073,"library":"update-browserslist-db","title":"Update Browserslist DB","description":"update-browserslist-db is a dedicated CLI tool designed to keep the `caniuse-lite` database up-to-date, which is crucial for modern front-end development workflows. Many build tools and development processes rely on Browserslist configurations (e.g., `last 2 versions`, `>1%`) to target specific browser features. These queries, in turn, depend on accurate and current data from `caniuse-lite`. This package ensures that the underlying browser compatibility data is refreshed, preventing stale targets and potential mismatches in transpilation or polyfilling. The current stable version is 1.2.3, with an active release cadence addressing compatibility across different package managers (npm, pnpm, yarn) and runtimes (Node.js, Bun). Its key differentiator is being the official, single-purpose tool for this specific and vital maintenance task within the Browserslist ecosystem, often run as a postinstall script or via a manual `npx` command.","status":"active","version":"1.2.3","language":"javascript","source_language":"en","source_url":"https://github.com/browserslist/update-db","tags":["javascript","caniuse","browsers","target","typescript"],"install":[{"cmd":"npm install update-browserslist-db","lang":"bash","label":"npm"},{"cmd":"yarn add update-browserslist-db","lang":"bash","label":"yarn"},{"cmd":"pnpm add update-browserslist-db","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"This tool updates data (caniuse-lite) that is consumed by Browserslist. A compatible version of Browserslist (>= 4.21.0) is a peer dependency for proper functioning and accurate data interpretation within a project.","package":"browserslist","optional":false}],"imports":[{"note":"This package is strictly a CLI tool and does not export any functions or classes for programmatic import and use within JavaScript/TypeScript applications. It is intended to be executed via command-line runners like `npx`, `pnpm exec`, or `yarn dlx`.","wrong":"import { updateBrowserslistDb } from 'update-browserslist-db'","symbol":"update-browserslist-db","correct":"npx update-browserslist-db@latest"}],"quickstart":{"code":"/*\nThis CLI tool is typically run in your project's root directory to update the 'caniuse-lite' data.\nIt is often included as a 'postinstall' script in package.json or run manually when browser support data needs refreshing.\n*/\n\nconsole.log(\"Updating caniuse-lite and Baseline data...\");\n\n// 1. Using npx (Node.js/npm - recommended for one-off or scripts)\n//    npx automatically installs the package if not found and runs it.\n//    Command to run in your terminal:\n//    npx update-browserslist-db@latest\n\n// 2. If using pnpm\n//    Command to run in your terminal:\n//    pnpm exec update-browserslist-db latest\n\n// 3. If using yarn\n//    Command to run in your terminal:\n//    yarn dlx update-browserslist-db@latest\n\n// Example of how to add it to package.json scripts:\n/*\n{\n  \"name\": \"my-project\",\n  \"version\": \"1.0.0\",\n  \"scripts\": {\n    \"postinstall\": \"update-browserslist-db\"\n  },\n  \"peerDependencies\": {\n    \"browserslist\": \">=4.21.0\"\n  }\n}\n*/","lang":"javascript","description":"Demonstrates how to execute the `update-browserslist-db` CLI tool using `npx`, `pnpm exec`, and `yarn dlx` to refresh `caniuse-lite` and Baseline browser support data, including a common `postinstall` script usage."},"warnings":[{"fix":"Upgrade to the latest stable version (>=1.2.3) for improved and more stable Bun compatibility. Verify your Bun environment is also up-to-date.","message":"Early versions of `update-browserslist-db` had inconsistent or broken support for Bun, leading to update failures or unexpected behavior when run in Bun environments. This was addressed incrementally across several releases.","severity":"gotcha","affected_versions":"<=1.2.2"},{"fix":"Ensure you are using `pnpm` with the latest version of `update-browserslist-db` (>=1.2.3) and `browserslist` (>=4.21.0) in your project.","message":"When using pnpm, some earlier versions could unexpectedly modify `package.json` or fail to update correctly, especially with specific `depth` configurations or when used with older Browserslist versions. This could lead to build failures or incorrect browser data.","severity":"gotcha","affected_versions":"<=1.2.2"},{"fix":"Update Node.js to a currently supported LTS version and ensure `update-browserslist-db` is at version 1.0.16 or newer for compatibility.","message":"Older Node.js environments (specifically pre-1.0.16) might encounter compatibility issues, preventing the `update-browserslist-db` tool from running successfully or completing its update process.","severity":"gotcha","affected_versions":"<=1.0.15"}],"env_vars":null,"last_verified":"2026-04-22T00:00:00.000Z","next_check":"2026-07-21T00:00:00.000Z","problems":[{"fix":"Upgrade `update-browserslist-db` to version 1.2.1 or newer, and ensure your project's `peerDependencies` include `browserslist: \">=4.21.0\"` to meet compatibility requirements.","cause":"This error occurs when using pnpm with older versions of `update-browserslist-db` or an incompatible `browserslist` peer dependency, where pnpm's dependency resolution might fail due to package linking issues.","error":"ERR_PNPM_NO_PACKAGE_IN_DEPENDENCIES"}],"ecosystem":"npm","meta_description":null}