ui: [bug]: request to https://ui.shadcn.com/r/styles/index.json failed

Describe the bug

While trying to exec shadn@latest init, the index.json is timing out:

npx shadcn@latest init
✔ Preflight checks.
✔ Verifying framework. Found Next.js.
✔ Validating Tailwind CSS.
✔ Validating import alias.


Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.

request to https://ui.shadcn.com/r/styles/index.json failed, reason: connect ETIMEDOUT 76.76.21.164:443

I’m able to acccess the json via web browser:

  {
    "name": "new-york",
    "label": "New York"
  },
  {
    "name": "default",
    "label": "Default"
  }
]

Affected component/components

core

How to reproduce

npx shadcn@latest init

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

macOS Sonoma

Before submitting

  • I’ve made research efforts and searched the documentation
  • I’ve searched for existing issues

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 12
  • Comments: 38

Most upvoted comments

It happen with my company network, they are using proxy for the security reason, when i tried with mobile network in my personal laptop, it worked, but not working in all the PC in my company.

Solution: For those who using proxy, write this in CMD, where your project is open

set http_proxy=http://your.proxy:5050
set https_proxy=http://your.proxy:5050
set http.proxyStrictSSL=false
set NODE_TLS_REJECT_UNAUTHORIZED=0

Now you can exec = npx shadn@latest init

ایرانی های عزیز از DNS های تحریم شکن مثل https://begzar.ir/ https://shecan.ir/ استفاده کنید اگر جواب نگرفتین از کانفیگ هایی استفاده کنید که دی ان اس cloudflare نداشته باشه اگر از v2ray استفاده میکنید حتما enable tunnel باشه برای خودم وی پی ان کانادا و DNS بگذر توی شرایط جنگی و قطعی نت جواب داد

I was able to resolve the issue by turning on the VPN and changing the location to the US

Issue solved! Here’s a step-by-step solution that worked for me:

  1. Environment Requirements:

    • Node.js >= v18.17.0
    • Stable proxy configuration
  2. Key Steps:

    # 1. Verify network access
    curl https://ui.shadcn.com/r/index.json  # Should return 200 OK
    
    # 2. Minimize proxy settings (PowerShell)
    $env:HTTPS_PROXY="http://127.0.0.1:7890"  # Replace with your proxy port
    
    # 3. Run installation with global flag
    npx --location=global shadcn@latest init
    
  3. Proxy Tool Settings (if using Clash):

    • TUN mode: OFF
    • Allow LAN: ON
    • Ensure proxy is running properly

The key was to simplify the environment configuration and use the --location=global flag with npx. This resolved both the ETIMEDOUT and TLS connection issues.

Hope this helps others facing similar issues! 🚀

I solve it.

  1. ping ui.shacn.com you have ip not timeout same ping ui.shadcn.com PING cname.vercel-dns.com (76.76.21.98) 56(84) bytes of data. 64 bytes from 76.76.21.98: icmp_seq=1 ttl=245 time=31.8 ms
  2. Get IP add to /etc/hosts file 76.76.21.98 ui.shadcn.com

Then try to run npx shadcn@latest init

I resolved this by turning off my VPN. Maybe the IP I was using was blocked?

I had the same problem, but I switched my computer network to a phone hotspot and the installation went fine

I have a new idea: use pnpx instead of npx to speed up installation and get rid of Internet errors.

问题解决了!以下是对我有用的分步解决方案:

  1. 环境要求:

    • Node.js >= v18.17.0
    • 稳定的代理配置
  2. 关键步骤:

    # 1. Verify network access
    curl https://ui.shadcn.com/r/index.json  # Should return 200 OK
    
    # 2. Minimize proxy settings (PowerShell)
    $env:HTTPS_PROXY="http://127.0.0.1:7890"  # Replace with your proxy port
    
    # 3. Run installation with global flag
    npx --location=global shadcn@latest init
    
  3. 代理工具设置(如果使用 Clash):

    • TUN 模式:关闭
    • 允许 LAN:开启
    • 确保代理正常运行

关键是简化环境配置并将--location=global标志与 npx 一起使用。这解决了 ETIMEDOUT 和 TLS 连接问题。

希望这能帮助其他面临类似问题的人!🚀

问题解决了!以下是对我有用的分步解决方案:

  1. 环境要求:

    • Node.js >= v18.17.0
    • 稳定的代理配置
  2. 关键步骤:

    # 1. Verify network access
    curl https://ui.shadcn.com/r/index.json  # Should return 200 OK
    
    # 2. Minimize proxy settings (PowerShell)
    $env:HTTPS_PROXY="http://127.0.0.1:7890"  # Replace with your proxy port
    
    # 3. Run installation with global flag
    npx --location=global shadcn@latest init
    
  3. 代理工具设置(如果使用 Clash):

    • TUN 模式:关闭
    • 允许 LAN:开启
    • 确保代理正常运行

关键是简化环境配置并将--location=global标志与 npx 一起使用。这解决了 ETIMEDOUT 和 TLS 连接问题。

希望这能帮助其他面临类似问题的人!🚀

感谢。It works!

shit ,after my attempts, I hava found an avniable host address so far .please configure you hosts file to add this mapping 76.76.21.241 cname.vercel-dns.com . before the configuration please ping it to ensure the network is normal,in the configuration . if you find other host addresses .please share it

I tried several method but failed:

  1. Set a npm proxy and https-proxy
  2. Set a system HTTP_PROXY and HTTPS_PROXY
  3. Set a registry for npm
  4. Enable and disable the TUN mode in my proxy app

However, when I upgrade the Node.js installation on Windows, the problem didn’t exist any more.

So there are my problems and the solutions:

  1. npm connection unstable: Try using a proxy and a registry
  2. ui.shadcn.com won’t connect via https: Try upgrading your Node.js to a newer version (eg. the latest of lts)

Maybe it’s something with Vercel DNS.

ping ui.shadcn.com
PING cname.vercel-dns.com (76.76.21.164): 56 data bytes
Request timeout for icmp_seq 0