
Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag storeThis is a Windows-specific environment variable issue where the Sanity CLI can't find PowerShell because the SystemRoot environment variable is undefined or missing. The error spawn undefined\System32\WindowsPowerShell\v1.0\powershell ENOENT shows that it's trying to construct the path to PowerShell but getting "undefined" instead of C:\Windows.
Here are the solutions to fix this:
Solution 1: Set the SystemRoot environment variable
The SystemRoot environment variable is missing or not accessible. You need to set it:
setx SystemRoot C:\Windows /Mnpm create sanity@latest againSolution 2: Use the login URL manually
If the above doesn't work, you can manually authenticate:
npm create sanity@latest againhttps://api.sanity.io/v1/auth/login/google?... part)Solution 3: Try a different terminal
Sometimes this is terminal-specific. Try using:
Solution 4: Update Node.js
You're running Node.js v18.12.1. Try updating to a more recent Node.js version (Node 20+ is now recommended for Sanity Studio v4). Sometimes environment variable handling is improved in newer Node versions.
Solution 5: Check environment variables manually
Verify your environment variables are intact:
SystemRoot exists in System variables and is set to C:\WindowsThe root cause is that the Sanity CLI uses the open package to launch your browser for authentication, which on Windows tries to use PowerShell, but it can't construct the correct path without the SystemRoot variable. Solution 1 is usually the quickest fix!
Sanity is the developer-first content operating system that gives you complete control. Schema-as-code, GROQ queries, and real-time APIs mean no more workarounds or waiting for deployments. Free to start, scale as you grow.
Content operations
Content backend


The only platform powering content operations
By Industry


Tecovas strengthens their customer connections
Build and Share

Grab your gear: The official Sanity swag store
Read Grab your gear: The official Sanity swag store