Discussion about resolving a BrowserslistError in package.json

6 replies
Last updated: Feb 24, 2022
BrowserslistError: Unknown browser query
dead

I was getting this error, even with all updated packages.
AI Update

This error isn't specific to Sanity, but it's a common issue in modern JavaScript projects including Sanity Studio setups. The BrowserslistError: Unknown browser query 'dead' happens when your project configuration references the "dead" browser query, but an outdated version of Browserslist in your dependency tree doesn't recognize it.

The "dead" query was introduced in Browserslist v4.21.0 (July 2022) to identify browsers that are officially discontinued with very low usage. Even if your direct packages are updated, nested dependencies can still pull in older Browserslist versions.

Here's how to fix it:

1. Force update Browserslist across your entire dependency tree:

# For npm
npm install browserslist@latest --save-dev
npx npm-force-resolutions

# For yarn
yarn add browserslist@latest --dev
yarn install --force

# For pnpm
pnpm add -D browserslist@latest
pnpm install --force

2. Clear all caches and reinstall (most reliable solution):

# npm
rm -rf node_modules package-lock.json
npm cache clean --force
npm install

# yarn
rm -rf node_modules yarn.lock
yarn cache clean
yarn install

# pnpm
rm -rf node_modules pnpm-lock.yaml
pnpm store prune
pnpm install

The cache clearing approach is often necessary because package managers can cache resolved dependency versions, and simply running npm update won't always catch deeply nested outdated packages.

3. Use npm overrides/resolutions (if the problem persists):

Add this to your package.json to force a minimum Browserslist version throughout your entire dependency tree:

{
  "overrides": {
    "browserslist": "^4.21.0"
  }
}

For Yarn, use resolutions instead:

{
  "resolutions": {
    "browserslist": "^4.21.0"
  }
}

4. Temporary workaround (if you need to build immediately):

If you have a .browserslistrc file or browserslist field in package.json, you can temporarily replace the "dead" query with an equivalent:

# Instead of:
not dead

# Use:
> 0.2%
not ie <= 11
not op_mini all

After applying these fixes, your build tools (Next.js, Vite, or Sanity Studio's bundler) should recognize the "dead" query properly. The cache clearing approach (solution #2) combined with forcing Browserslist updates typically resolves this issue permanently.

In your
package.json
, do you have a
browserslist
option? If so can you share it?
no, doesn't have.
here you can look at:


{
 
_"name"_: "marbles-studio",
 
_"private"_: true,
 
_"version"_: "1.0.0",
 
_"description"_: "",
 
_"main"_: "package.json",
 
_"author"_: "andyatflocc <<mailto:andy@flocc.co|andy@flocc.co>>",
 
_"license"_: "UNLICENSED",
 
_"scripts"_: {
   
_"start"_: "sanity start",
   
_"build"_: "sanity build"
  },
 
_"keywords"_: [
    "sanity"
  ],
 
_"dependencies"_: {
   
_"@sanity/base"_: "^2.27.1",
   
_"@sanity/cli"_: "^2.27.0",
   
_"@sanity/components"_: "^2.14.0",
   
_"@sanity/core"_: "^2.27.0",
   
_"@sanity/dashboard"_: "^2.27.1",
   
_"@sanity/default-layout"_: "^2.27.1",
   
_"@sanity/default-login"_: "^2.27.0",
   
_"@sanity/desk-tool"_: "^2.27.1",
   
_"@sanity/google-maps-input"_: "^2.27.1",
   
_"@sanity/production-preview"_: "^2.15.0",
   
_"@sanity/vision"_: "^2.27.1",
   
_"@weflocc/kata"_: "^2.0.26",
   
_"@weflocc/kata-studio"_: "^1.3.48",
   
_"get-youtube-id"_: "^1.0.1",
   
_"prop-types"_: "^15.8",
   
_"react"_: "^17.0",
   
_"react-dom"_: "^17.0",
   
_"react-icons"_: "^4.3.1",
   
_"react-youtube"_: "^7.14.0",
   
_"sanity-plugin-dashboard-widget-document-list"_: "^0.0.13",
   
_"sanity-plugin-dashboard-widget-netlify"_: "^1.2.1",
   
_"sanity-plugin-media"_: "^1.4.4",
   
_"sanity-plugin-mux-input"_: "^1.1.0",
   
_"sanity-plugin-order-documents"_: "^0.0.22",
   
_"sanity-plugin-table"_: "^2.3.0",
   
_"styled-components"_: "^5.3.3"
  },
 
_"devDependencies"_: {
   
_"babel-eslint"_: "^10.0.1",
   
_"eslint"_: "^8.9.0",
   
_"eslint-config-standard"_: "^16.0.3",
   
_"eslint-config-standard-react"_: "^11.0.1",
   
_"eslint-plugin-import"_: "^2.25.4",
   
_"eslint-plugin-node"_: "^11.1.0",
   
_"eslint-plugin-promise"_: "^6.0.0",
   
_"eslint-plugin-react"_: "^7.28.0",
   
_"eslint-plugin-standard"_: "^4.1.0",
   
_"prettier"_: "^2.5.1",
   
_"prettier-eslint-cli"_: "^5.0.1"
  }
}
Hmm, some of those packages aren't from Sanity, so I can't be sure that they're not relying on an outdated browserlist. Can you try the solution in this article to see if it helps?
I tried this and no success 😢
I think I'll try to build from scratch
fixed when I inserted the
"browserslist": { "production": [ "&gt;0.2%", "not dead", "not op_mini all" ], "development": [] }

inside my package.json.

I have to make yarn upgrade as well

Sanity – Build the way you think, not the way your CMS thinks

Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.

Was this answer helpful?