#Setup issue with Sanity CMS integration for Astro

11 messages · Page 1 of 1 (latest)

robust crystal
#

Hi all, I've just setup a new Sanity/Astro project by following the 'Getting Started' instructions as shown in the Sanity dashboard. Dev servers 3333 and 4321 are working fine but after deploying my Sanity Studio, I'm seeing the following error message in Google Chrome:

Uncaught error: The requested module 'react' does not provide an export named 'useMemo'
https://astroheadless.sanity.studio/vendor/styled-components/index-D6hUPlVp.mjs:1:29
SyntaxError: The requested module 'react' does not provide an export named 'useMemo'

The error can be viewed live here -
https://astroheadless.sanity.studio/

I've noticed that package.json in my Sanity studio directory is showing react and react dom dependencies v18.2.0, whereas package.json in my Astro project directory is showing react and react dom v19.0.0. Is this correct?

This is my first time setting up Sanity integration for Astro and I've no prior experience using React.

Is anyone here able to help?

Thanks, Adam

wicked sorrel
#

Hi! Can you try downgrading to the latest React 18.x? People have been having issues with React 19.

#

As you pointed out, that dependency mismatch might be the cause

robust crystal
#

Hi @wicked sorrel, thanks for getting back to me. I've just tried switching to React v18.3.0 but I'm still experiencing the same issue.

valid sail
#

Just a heads up I get a different error when visiting

robust crystal
#

@valid sail Yes, I'm seeing that error when viewed in Safari.

My project setup is simply the default starter setup as shown in the Getting Started guide within the Sanity dashboard. I cannot see anywhere in my code where createElement or useMemo would need to be imported.

valid sail
#

Do you have any react islands or libs?

robust crystal
#

@valid sail No. No errors showing in VS Code either.

robust crystal
#

Somebody at the Sanity community on Slack has just posted that they have the same issue. Still awaiting a solution. Will update here if I hear anything.

valid sail
#

Yeah I'm a bit spend for ideas as I've not used sanity 😅

Perhaps someone with more knowledge then I will pop in here when they have time

robust crystal