ui icon indicating copy to clipboard operation
ui copied to clipboard

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

Open luco opened this issue 1 year ago • 25 comments

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

  • [X] I've made research efforts and searched the documentation
  • [X] I've searched for existing issues

luco avatar Sep 02 '24 15:09 luco

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

luco avatar Sep 02 '24 15:09 luco

Now pinging correctly:

ping ui.shadcn.com
PING cname.vercel-dns.com (76.76.21.61): 56 data bytes
64 bytes from 76.76.21.61: icmp_seq=0 ttl=243 time=11.711 ms
64 bytes from 76.76.21.61: icmp_seq=1 ttl=243 time=14.729 ms
64 bytes from 76.76.21.61: icmp_seq=2 ttl=243 time=11.605 ms

luco avatar Sep 02 '24 17:09 luco

@luco 怎么解决的呢?

guojian0911 avatar Sep 26 '24 13:09 guojian0911

please how can i go around this issue, because i have been trying to install nextjs with shadcn but i keep getting this error.

amjido-01 avatar Oct 03 '24 12:10 amjido-01

It's something with Vercel DNS I think.

luco avatar Oct 04 '24 12:10 luco

It's back lol. Same timeout:

PING 76.76.21.164 (76.76.21.164): 56 data bytes
Request timeout for icmp_seq 0
Request timeout for icmp_seq 1
Request timeout for icmp_seq 2
Request timeout for icmp_seq 3
Request timeout for icmp_seq 4
Request timeout for icmp_seq 5
Request timeout for icmp_seq 6
Request timeout for icmp_seq 7
Request timeout for icmp_seq 8
Request timeout for icmp_seq 9
Request timeout for icmp_seq 10

luco avatar Oct 08 '24 13:10 luco

I have the same problem

➜  front git:(main) ✗ npx shadcn@latest add form   
⠧ Checking registry.

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/index.json failed, reason: 

franckDev21 avatar Oct 08 '24 20:10 franckDev21

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

sgarchavada avatar Oct 16 '24 06:10 sgarchavada

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

metclan avatar Oct 17 '24 06:10 metclan

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

This doesn't work for me, is there any other solution?

gongsungg avatar Oct 25 '24 07:10 gongsungg

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

Forfires avatar Oct 27 '24 11:10 Forfires

image

image

jooler avatar Nov 03 '24 13:11 jooler

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)

dongzhenye avatar Nov 05 '24 14:11 dongzhenye

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! 🚀

dongzhenye avatar Nov 05 '24 14:11 dongzhenye

curl https://ui.shadcn.com/r/index.json

image

gongsungg avatar Nov 06 '24 09:11 gongsungg

curl https://ui.shadcn.com/r/index.json

image

You may use a proxy first.

dongzhenye avatar Nov 06 '24 15:11 dongzhenye

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

dongzhenye avatar Nov 09 '24 09:11 dongzhenye

Most times the issue is your internet IP address. What I did was I changed to a different IP. Changing your IP can be in many factors:

  1. Changing your network provider
  2. Changing to a new IP like did which was moving to a mifi
  3. Changing your network proxy(I didn't do this since two worked)

Davidon4 avatar Nov 15 '24 10:11 Davidon4

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

batmanx64 avatar Nov 18 '24 02:11 batmanx64

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

  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!

mrjzz avatar Dec 03 '24 07:12 mrjzz

@luco 怎么解决的呢?

别开代理就行了

zhongjiaguo001 avatar Dec 03 '24 13:12 zhongjiaguo001

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

saeyesss avatar Dec 30 '24 16:12 saeyesss

Also was fixed just by turning off my VPN

art-c0der avatar Jan 06 '25 10:01 art-c0der

Why is my cmd pinging to different IP than yours?

C:\Windows\System32>ping ui.shadcn.com

Pinging cname.vercel-dns.com [66.33.60.129] with 32 bytes of data:
Request timed out.
Request timed out.
Request timed out.
Request timed out.

Ping statistics for 66.33.60.129:
    Packets: Sent = 4, Received = 0, Lost = 4 (100% loss),

klugeradoslaw avatar Feb 11 '25 05:02 klugeradoslaw

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

codehappyness avatar Mar 12 '25 02:03 codehappyness

my problem is using 1.1.1.1 dns config. Remove it fixed for me (change to 8.8.8.8)

sgtpsibin avatar Mar 24 '25 05:03 sgtpsibin

You guys can try using node v20. It's work for me!

vitiskina avatar Mar 27 '25 09:03 vitiskina

我也遇到了问题,但是在之前是好的,就在昨天,他出现了这种问题

tongque0 avatar Mar 30 '25 01:03 tongque0

我也遇到了问题,但是在之前是好的,就在昨天,他出现了这种问题

我查询了国外版的文档,在安装组件时,使用pnpm dlx shadcn@latest add button 而不是国内版v4文档下的pnpm dlx shadcn@canary button 解决了这个问题

tongque0 avatar Mar 30 '25 02:03 tongque0

Same issues and resolved by VPN 1111.

kieuhuynhdev avatar Apr 07 '25 12:04 kieuhuynhdev