framer-motion flushSync not found in framesync error in Sanity + Gatsby
This error isn't actually a Sanity-specific issue—it's a general JavaScript dependency compatibility problem between framer-motion and framesync packages that's occurring in your Gatsby build process. While you're working on a Sanity + Gatsby monorepo, this particular error is related to your bundler's dependency resolution, not Sanity itself.
The error message "export 'flushSync' was not found in 'framesync'" indicates that framer-motion is trying to import a function that doesn't exist in the version of framesync that's currently installed. This typically happens when there's a version mismatch between these two packages.
Quick fixes to try:
- Clean install (resolves most cases):
rm -rf node_modules yarn.lock
yarn install- Force compatible versions using Yarn resolutions in your root
package.json:
{
"resolutions": {
"framesync": "^6.1.0",
"framer-motion": "^10.16.0"
}
}- Check for duplicate installations in your monorepo:
yarn why framer-motion
yarn why framesyncSince this is a general bundler/dependency issue rather than a Sanity problem, you might get better help in these communities:
- Gatsby Discord or Gatsby GitHub Discussions
- Framer Motion GitHub Issues (search for "flushSync framesync")
- Stack Overflow with tags for Gatsby and webpack
The Sanity community focuses on content modeling, GROQ queries, Studio customization, and Sanity-specific integrations. For build tooling and dependency resolution issues like this one, the framework-specific communities will have more expertise to help you troubleshoot.
Show original thread11 replies
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.