Error message when running "sanity init" command in React project on Windows

3 replies
Last updated: Oct 18, 2022
Hello everyone, I'm trying to add sanity to my react project and whenever I try to run the "sanity init" command, I'm getting an error message. This is the message: You're setting up a Sanity.io project!We'll make sure you're logged in with
Sanity.io .Then, we'll install a Sanity Studio for your project.

Press ctrl + C at any time to quit.

We can't find any auth credentials in your Sanity config
- log in or create a new account


Opening browser at
https://api.sanity.io/v1/auth/login/sanity?type=listen&uuid=bbbcd622884f8f3a9ac7760981b8e379&source=cli
⠋ Waiting for browser login to complete... Press Ctrl + C to cancelnode
:events:491 throw er; // Unhandled 'error' event
^

Error: spawn cmd ENOENT
at Process.ChildProcess._handle.onexit (node
:internal/child_process:285:19) at onErrorNT (node
:internal/child_process:485:16) at processTicksAndRejections (node
:internal/process/task_queues:83:21)Emitted 'error' event on ChildProcess instance at:
at Process.ChildProcess._handle.onexit (node
:internal/child_process:291:12) at onErrorNT (node
:internal/child_process:485:16) at processTicksAndRejections (node
:internal/process/task_queues:83:21) { errno: -4058,
code: 'ENOENT',
syscall: 'spawn cmd',
path: 'cmd',
spawnargs: [
'/c',
'start',
'""',
'/b',
'
https://api.sanity.io/v1/auth/login/sanity?type=listen^&uuid=bbbcd622884f8f3a9ac7760981b8e379^&source=cli ' ]
} I'm stuck, Help.
Oct 15, 2022, 10:03 PM
As a Windows user who runs into command line issues on occasion, I am wondering if the problem might be resolved by one of these solutions, which all seem to relate to environment variables on the OS: https://stackoverflow.com/questions/57054403/problem-with-npm-start-error-spawn-cmd-enoent
Oct 18, 2022, 1:02 PM
Thank you so much.. You pointed me in the right direction, the issue is now gone... I was missing a path pointing  to System32 in the environment variables.
Oct 18, 2022, 10:08 PM
No problem! It's not easy to notice and sometimes a single letter off of what it says it wants keeps everything from working.
Oct 18, 2022, 10:32 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?