🎤 Builder Talk: The Story Behind Lady Gaga’s Digital Experience – Register now

Troubleshooting installation error with Sanity in a React project folder.

20 replies
Last updated: Feb 23, 2021
I just tried installing sanity inside of my project folder (I failed to do that before) and now I'm getting a different error about something missing.
Feb 23, 2021, 12:38 PM
Hey Kieran! Let’s see if we can troubleshoot this. What command did you use to originally install Sanity?
Feb 23, 2021, 5:58 PM
Hello
user M
thanks for checking in on my problem. I used
npm install -g @sanity/cli
from inside my react project's folder
Feb 23, 2021, 6:01 PM
Next, I used
sanity login
for logging in followed by
sanity init
which is when the error showed up. I couldnt find any fixes yet so the whole process is on hold
Feb 23, 2021, 6:03 PM
During the various steps for of
sanity init
process when it starts
resolving dependencies
it throws that error
Feb 23, 2021, 6:05 PM
Hmm, this looks like someone who had a similar error. Try to
cd
into your project folder and run
npm install node_modules
and see if that helps.
Feb 23, 2021, 6:08 PM
Sure checking it out now, thanks
Feb 23, 2021, 6:09 PM
Doesn't seem to work sadly, Gives me another error
Feb 23, 2021, 6:13 PM
Just fyi, I ran
npm install
inside my project folder just now and tried
sanity init
its throwing the same error when resolving dependencies
Feb 23, 2021, 6:25 PM
I looks like you may have installed Sanity just as we were releasing the v2.4.0 version - sometimes the NPM registry is not fully up to date during the publishing process, which can lead to this (initial) error message.
I would try removing
node_modules
(
rm -rf node_modules
) and reinstalling dependencies (
npm install
).
Having said that, the latest error you're seeing is odd - maybe the official npm registry is having some issues? That module isn't one of "ours"...
Feb 23, 2021, 6:27 PM
Can you try doing the mentioned rm + npm install proceedure and see if that helps? The
sanity
command uses yarn internally instead of npm, so it might have slightly different behavior
Feb 23, 2021, 6:28 PM
I'm already working on it
user Z
hopefully it works this time lol. I've been stuck here all day unable to do anything with the project sighs
Feb 23, 2021, 6:30 PM
One of those days, eh? 😓
Feb 23, 2021, 6:30 PM
Yuppers 😞 It's my first ever react project and was excited to building it with sanity but here we are LOL
Feb 23, 2021, 6:31 PM
Sorry to hear that, let me know how the install goes :x
Feb 23, 2021, 6:33 PM
Ah crap! I'm now getting a whole new error with
npm install
now 🤦‍♀️
Feb 23, 2021, 6:36 PM
Uh. Never seen that before.The interwebs suggest
npm cache clean --force
and re-running
npm install
, but I'm on thin ice here 😅
Feb 23, 2021, 6:50 PM
I removed the
node-modules
again, restarted the terminal and installed npm and it worked without any errors, weird and I've run into that
cb error
before not sure how I resolved it. I'm now running
sanity init
Feb 23, 2021, 6:53 PM
As for the
cb() never called error
from above picture, they have a whole repo of issues from hundreds of folx and seems its unique to every single occurence and there's a whole lot of steps to reproduce the problem/error and then we gotta create a new issue on their repo and wait patiently for a fix, which could happen all over again lol
Feb 23, 2021, 6:56 PM
user Z
It actually went through this time and its working. Sorry took me a while to let ya know, I've got a slow connection here. I still have no idea why that even happened, apparently its something I deal with every time I either create a new react-app or something new related to npm.
It's working now though. Thanks for your help and
user M
, appreciate it
Feb 23, 2021, 7:11 PM
Sounds frustrating! I’m glad it worked out now though!
Feb 23, 2021, 7:15 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?

Related answers

Get more help in the community Slack

TopicCategoriesFeaturedRepliesLast Updated
How to turn PortableText into plain text in Javascript?Dec 7, 2020
Custom Document Views - Is it Even Possible to Use the Structure Builder?Apr 21, 2022
Error: unable to resolve image URL from source (undefined)Sep 11, 2022
How to Disallow Robots on a SubdomainNov 12, 2020
Adding a ref to the body tag using Helmet in ReactJul 2, 2020
Error when deploying Next.js + Sanity project to Vercel with Lerna and React-IconsJan 21, 2021
Hello all! I’m trying to render a code block in a Portable Text Block, followed the instructions to add the serializer and...Feb 3, 2021
Best practices for using image sizes in React projects with Sanity.ioMay 21, 2020
How do I render the image in Sanity blockcontent into a custom image component?Nov 28, 2020
Tips for using block-content-to-react in a Gatsby app with GraphQL dataApr 24, 2020

Related contributions

Turbo Start Sanity
- Template

The battle-tested Sanity template that powers Roboto Studio's websites

Go to Turbo Start Sanity

Schema UI - Next.js Sanity Starter
- Template

A Next.js starter template with Next.js 15, Tailwind CSS, shadcn/ui, and Sanity CMS with Live Editing. Get production-ready React components with matching Sanity schemas and queries. Build dynamic pages faster while keeping full control over customization.

Serge Ovcharenko
Go to Schema UI - Next.js Sanity Starter

The Swaddle
- Made with Sanity

A new brand identity to represent a more mature company, to signify The Swaddle’s evolution from publisher to production house, combined with an easier to navigate platform that can surface multiple content types - drawing readers through The Swaddle’s content offering.

Nightjar
Go to The Swaddle