Troubleshooting login error with npm create sanity@latest command

8 replies
Last updated: Feb 28, 2023
Hello. Am trying to start a new sanity project using npm create sanity@latest . It installs the node packages. Then gets to the login prompts for different options(Google, Github, Email). I select any of them, but the terminal returns a wild error! Here is what it returns :? Login type Google
Opening browser at
https://api.sanity.io/v1/auth/login/google?type=listen&uuid=dfe6ead8885119fbdcfb100be38c997f&source=cli&label=DESKTOP-L0OHL9K+%2F+win32
- Waiting for browser login to complete... Press Ctrl + C to cancelnode
:events:491 throw er; // Unhandled 'error' event
^

Error: spawn undefined\System32\WindowsPowerShell\v1.0\powershell ENOENT
at ChildProcess._handle.onexit (node
:internal/child_process:283:19) at onErrorNT (node
:internal/child_process:476:16) at process.processTicksAndRejections (node
:internal/process/task_queues:82:21)Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node
:internal/child_process:289:12) at onErrorNT (node
:internal/child_process:476:16) at process.processTicksAndRejections (node
:internal/process/task_queues:82:21) { errno: -4058,
code: 'ENOENT',
syscall: 'spawn undefined\\System32\\WindowsPowerShell\\v1.0\\powershell',
path: 'undefined\\System32\\WindowsPowerShell\\v1.0\\powershell',
spawnargs: [
'-NoProfile',
'-NonInteractive',
'–ExecutionPolicy',
'Bypass',
'-EncodedCommand',
'UwB0AGEAcgB0ACAAIgBoAHQAdABwAHMAOgAvAC8AYQBwAGkALgBzAGEAbgBpAHQAeQAuAGkAbwAvAHYAMQAvAGEAdQB0AGgALwBsAG8AZwBpAG4ALwBnAG8AbwBnAGwAZQA/AHQAeQBwAGUAPQBsAGkAcwB0AGUAbgAmAHUAdQBpAGQAPQBkAGYAZQA2AGUAYQBkADgAOAA4ADUAMQAxADkAZgBiAGQAYwBmAGIAMQAwADAAYgBlADMAOABjADkAOQA3AGYAJgBzAG8AdQByAGMAZQA9AGMAbABpACYAbABhAGIAZQBsAD0ARABFAFMASwBUAE8AUAAtAEwAMABPAEgATAA5AEsAKwAlADIARgArAHcAaQBuADMAMgAiAA=='
]
}

Node.js v18.12.1
Feb 24, 2023, 5:21 AM
Hi
user V
. Would you be able to give this a try, please? It looks like this is a reported bug in a third-party dependency that impacts Windows PowerShell users. Until this is resolved, a confirmed workaround is to login using
sanity login --no-open
, which will provide you with a link you can follow to authenticate but not attempt to open the browser for you. This should provide enough of a delay to circumvent the issue.
Feb 24, 2023, 2:32 PM
I have this same problem, I'm trying to follow this tutorial on YouTube: https://www.youtube.com/watch?v=CcBHZ0t2Qwc
The workaround you have mentioned doesn't seem to work (or maybe I'm just doing it wrong).

I reinstalled node and npm, too, which was something mentioned in your troubleshooting guide.
Feb 25, 2023, 7:45 AM
Hi, had the same issue, use gitbash for your terminal, will fix that problem right away
Feb 25, 2023, 7:28 PM
Tried that fix , didn't work. Any other suggesstion?
Feb 27, 2023, 1:24 PM
user R
user R
The workaround would be to log in using
sanity login --no-open
, follow the link, and then return to the terminal. If that’s what you’ve tried and are still having an issue, please start a thread and post the error you’re seeing. Thanks!
Feb 27, 2023, 10:52 PM
This worked like a charm👍 ❤️ ...thanks..I have my sanity studio up and running 🏃‍♂️
Feb 28, 2023, 10:14 PM
Great! Thanks for following up to let us know. In a future version (not yet sure when), we’ll be implementing a workaround, since I don’t believe the third-party author plans to fix it on their end. That means this approach should be fairly temporary (hopefully less than a week).
Enjoy building!
Feb 28, 2023, 10:16 PM
Ere is how things have been all along, and the result after the using a solution above
Feb 28, 2023, 10:19 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?