Fix "upstream server is timing out" error when running npm create sanity@latest

8 replies
Last updated: Feb 2, 2024
Hi, I want to start build project in sanity with npm -y create sanity@latest, but after trying many times this error keeps appearing, how to fix this?

Error: The upstream server is timing out _at onResponse (C:/Users/ADMIN/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/@sanity/cli/lib/_chunks/loadEnv-NFU3msTN.js
:1652:13)_ _at applyMiddleware (C
:/Users/ADMIN/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/get-it/dist/index.cjs:53:13)_ _at onResponse (C
:/Users/ADMIN/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/get-it/dist/index.cjs:118:22)_ _at C
:/Users/ADMIN/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/get-it/dist/index.cjs:141:55_ _at callback (C
:/Users/ADMIN/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/get-it/dist/index.cjs:521:46)_ _at C
:/Users/ADMIN/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/get-it/dist/index.cjs:588:14_ _at DestroyableTransform.
anonymous (C:/Users/ADMIN/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/get-it/dist/index.cjs:273:7)_
at Object.onceWrapper (node628:28)
at DestroyableTransform.emit (node526:35) _at endReadableNT (C
:/Users/ADMIN/AppData/Local/npm-cache/_npx/67a0730928194b24/node_modules/readable-stream/lib/_stream_readable.js:1010:12)_
AI Update

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 -v

If 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 --force

Then 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@latest

Or for more detailed network information:

set SANITY_DEBUG=1
npm -y create sanity@latest

This 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 npx explicitly: npx -y create-sanity@latest
  • Using yarn instead: yarn create sanity@latest
  • Installing the CLI globally first: npm install -g @sanity/cli then running sanity 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 thread
8 replies
I am having this same issue right now.
I had this error after Sanity update, I try to uninstall and install again, logout and login again but nothing changes 😞
Are you to
user G
?
Same problem yeah :( hope it resolves soon
same problem here, so is saniity end problem?
The problem has been fix!
Glad to hear the issue has been resolved for you,
user G
- thanks for confirming! I hope the same is true for both of you,
user G
and
user H
.
user M
yeah it is successful now! Thanks Peter
All better for me as well!

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.

Was this answer helpful?