👀 See Sanity in action: Watch product demo now →

Next.js and Sanity Error - Module Not Found: Can't Resolve '@sanity/client'

5 replies
Last updated: May 29, 2021
Hey everyone, I'm new to all this and I'm sure I'm missing something simple but I'm running into the following on my next+sanity project:
Module not found: Can't resolve '@sanity/client'
> 1 | import sanityClient from '@sanity/client';`
I've been following this
tutorial on the sanity site (more or less)Any help or pointers would be greatly appreciated.
🙂
May 29, 2021, 8:29 PM
Is
@sanity/client
listed in
package.json
in the nextjs project folder?
May 29, 2021, 11:41 PM
no it's not
May 29, 2021, 11:44 PM
you’ll need to run
npm install @sanity/client
(or
yarn add @sanity/client
if you’re using yarn)
inside that folder and it should start working
May 29, 2021, 11:47 PM
And that was it! Thanks I knew it was something simple I forgot to do. Appreciate it!
May 29, 2021, 11:54 PM
That's strange running that seemed to resolve the error but it doesn't show in
package.json
May 29, 2021, 11:57 PM

Sanity.io – build remarkable experiences at scale

Sanity is a customizable solution that treats content as data to power your digital business. Free to get started, and pay-as-you-go on all plans.

Categorized in