Unlock seamless workflows and faster delivery with our latest releases - Join the deep dive

Sanity with React - Uncaught Error: Cannot find module '@sanity/client'

8 replies
Last updated: Dec 20, 2021
Hello everyone I am new to sanity .I am currently learning how to build a blog using sanity and react from this tutorial https://www.sanity.io/guides/build-your-first-blog-using-react#e65d5b1d1df8 I am currently facing the following error and i can't figure out how to solve it .
Uncaught Error: Cannot find module '@sanity/client'
    at webpackMissingModule (bundle.js:122)
    at Module../src/client.js (bundle.js:122)
    at Module.options.factory (bundle.js:49237)
    at __webpack_require__ (bundle.js:48675)
    at fn (bundle.js:48908)
    at Module../src/components/AllPosts.js (bundle.js:181)
    at Module.options.factory (bundle.js:49237)
    at __webpack_require__ (bundle.js:48675)
    at fn (bundle.js:48908)
    at Module../src/App.js (bundle.js:16)
Your help will be really appreciated Thanks
Dec 20, 2021, 10:21 AM
Have you installed the sanity client npm package?
npm install @sanity/client
?
Dec 20, 2021, 10:45 AM
yes
Dec 20, 2021, 11:43 AM
did you install in the
/src
folder or the project root?
Dec 20, 2021, 11:58 AM
project root
Dec 20, 2021, 12:18 PM
try installing it from the
/src
folder
Dec 20, 2021, 12:19 PM
okay
Dec 20, 2021, 12:20 PM
Thanks it worked
Dec 20, 2021, 12:25 PM
np
Dec 20, 2021, 12:47 PM

Sanity– build remarkable experiences at scale

Sanity is a modern 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?