Fix "upstream server is timing out" error when running npm create sanity@latest
The "upstream server is timing out" error you're experiencing when running npm -y create sanity@latest is typically a network connectivity issue where the Sanity CLI can't reach Sanity's servers. Here are several approaches to fix this:
1. Check Your Node.js Version
First, verify you're using Node.js 20 or higher, as Sanity Studio v4 requires Node.js version 20+. Run:
node -vIf you're on an older version, upgrade to Node.js 20 or later.
2. Network and Firewall Issues
The timeout error suggests a network connectivity problem. Try these steps:
- Check Sanity's status: Visit status.sanity.io to see if there are any ongoing service issues
- Check your firewall/antivirus: Your firewall or antivirus software might be blocking the CLI from connecting to Sanity's servers. Try temporarily disabling them to test
- VPN/Proxy: If you're using a VPN or corporate proxy, try disconnecting or configuring npm to work with your proxy
- Try a different network: If possible, switch to a different internet connection to rule out network-specific issues
3. Clear npm Cache
Your npm cache might be corrupted. Clear it with:
npm cache clean --forceThen try creating your Sanity project again.
4. Enable Debug Mode
To get more detailed error information, enable debug logging. On Windows, use:
set DEBUG=sanity:*
npm -y create sanity@latestOr for more detailed network information:
set SANITY_DEBUG=1
npm -y create sanity@latestThis will show you exactly where the timeout is occurring and might reveal the specific issue.
5. Try Alternative Installation Methods
If the issue persists, try:
- Using
npxexplicitly:npx -y create-sanity@latest - Using yarn instead:
yarn create sanity@latest - Installing the CLI globally first:
npm install -g @sanity/clithen runningsanity init
6. Windows-Specific Considerations
Since you're on Windows (based on your error path), also try:
- Running your command prompt or terminal as Administrator
- Checking if Windows Defender is blocking the connection
- Ensuring your Windows hosts file hasn't been modified to block Sanity domains
If none of these solutions work, the debug output should give you more specific information to share with Sanity support or the community for further assistance.
Show original thread8 replies
Sanity – Build the way you think, not the way your CMS thinks
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.