
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis is a dependency resolution issue that happens when migrating to newer Sanity versions! The error occurs because there's a mismatch in how your package manager is resolving the styled-components dependency in your CI environment versus locally.
Upgrade to styled-components v6:
pnpm add styled-components@^6
# or
npm install styled-components@^6
# or
yarn add styled-components@^6After upgrading, clear your build cache and reinstall:
rm -rf node_modules pnpm-lock.yaml
pnpm installWhile Sanity UI v2 officially supports both styled-components v5 and v6 (with peer dependencies of "^5.2 || ^6"), there's a critical difference in how these versions work in practice:
The reason it works locally but fails in GitHub Actions is due to dependency hoisting and resolution differences:
When you migrated from "super old sanity-next," you likely jumped from Sanity v2 (which used styled-components v5) to Sanity v3 (which uses Sanity UI v2). While Sanity UI v2 maintains backward compatibility with v5, upgrading to v6 resolves the export/import mismatch you're experiencing.
If you're using styled-components in your own code, note that v6 has some changes:
useInsertionEffect hookThe community member who had the exact same error in their GitHub Actions build confirmed that upgrading to styled-components v6 resolved it immediately.
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.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store