Issue with gatsby-source-sanity plugin and GraphQL resolved by starting a new folder with Gatsby v4.

6 replies
Last updated: May 13, 2022
Hello, I have a
gatsby-source-sanity
issue. GraphQL suddenly stopped working, so I’ve tried removing the plugin and now I get this:
ericphifer@Erics-MBP gatsby-prlogin % npm i gatsby-source-sanity
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: prhoa-gatsby-login@0.1.0
npm ERR! Found: gatsby@3.14.6
npm ERR! node_modules/gatsby
npm ERR!   gatsby@"^3.0.0" from the root project
npm ERR!   peer gatsby@"^3.0.0 || ^4.0.0" from gatsby-source-sanity@7.4.2
npm ERR!   node_modules/gatsby-source-sanity
npm ERR!     gatsby-source-sanity@"*" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer gatsby@"^4.0.0-next" from gatsby-plugin-image@2.14.1
npm ERR! node_modules/gatsby-plugin-image
npm ERR!   peer gatsby-plugin-image@"^1.0.0 || ^2.0.0" from gatsby-source-sanity@7.4.2
npm ERR!   node_modules/gatsby-source-sanity
npm ERR!     gatsby-source-sanity@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! 
npm ERR! See /Users/ericphifer/.npm/eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/ericphifer/.npm/_logs/2022-05-12T18_13_17_358Z-debug-0.log
Anyone know how to resolve this?
legacy-peer-deps
doesn’t seem to help…
May 12, 2022, 6:19 PM
Does
--force
help?
May 12, 2022, 7:55 PM
I may not be understanding the --force option, but if I force it without proper setup, won’t it just make it worse or make it breaking inevitable?
May 12, 2022, 8:07 PM
I am usually reckless.
May 12, 2022, 8:08 PM
Hi Eric.
--force
will force npm to fetch resources remotely even if they’re already local, so I don’t see it breaking something.
It’s interesting that
--legacy-peer-deps
didn’t work for you. What’s the error you’re getting after that?
May 12, 2022, 9:47 PM
Got it. Thank you, that’s helpful. I ended up resolving this by starting a folder from scratch with Gatsby v4, then adding in my plugins one at a time - that worked in localhost, so I migrated over my src folder and everything was working correctly, so I launched it last night and everything works.
I’ll be interested to learn more about
—-force
and
—-legacy-peer-deps
in the future, but for now I have resolved this one and I have another project waiting. Thank you both for your help - it’s largely because of people like you that I’m a developer. :)
May 13, 2022, 8:45 PM
Nice work, Eric! Happy to hear you're up and running. 🎉
May 13, 2022, 8:47 PM

Sanity– build remarkable experiences at scale

The Sanity Composable Content Cloud is the headless CMS that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Was this answer helpful?