shadcn-ui / ui

Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://ui.shadcn.com
MIT License
62.84k stars 3.53k forks source link

CLI - Failed to fetch tree from registry - ERR_SOCKET_CONNECTION_TIMEOUT #727

Closed MattEagle95 closed 1 year ago

MattEagle95 commented 1 year ago

I was following the documentation at https://ui.shadcn.com/docs/installation. After initializing the components.json with npx shadcn-ui@latest init I ran npx shadcn-ui@latest add and selected all components. It returns the error: "Failed to fetch tree from registry." - ERR_SOCKET_CONNECTION_TIMEOUT.

Using the command with a component npx shadcn-ui@latest add avatar does only work for some components, for others like "avatar", "command", "toggle" I get the same error.

I tried style: default and style: new-york.

Tried commands:

npx shadcn-ui@latest add (select all components)
npx shadcn-ui@latest add avatar
npx shadcn-ui@latest add avatar --overwrite
npx shadcn-ui@latest add avatar, ...

Error:

FetchError: request to https://ui.shadcn.com/registry/styles/new-york/avatar.json failed, reason: Socket connection timeout
    at ClientRequest.<anonymous> (file:///C:/Users/matteagle95/AppData/Local/npm-cache/_npx/125ee17d583c4e03/node_modules/node-fetch/src/index.js:108:11)
    at ClientRequest.emit (node:events:511:28)
    at TLSSocket.socketErrorListener (node:_http_client:495:9)
    at TLSSocket.emit (node:events:511:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ERR_SOCKET_CONNECTION_TIMEOUT',
  code: 'ERR_SOCKET_CONNECTION_TIMEOUT',
  erroredSysCall: undefined
}
Failed to fetch tree from registry.

OS/Project: OS: Windows 10 NextJS: 13.4.1

dan5py commented 1 year ago

Can you please try with:

npx shadcn-ui@0.2.2
MattEagle95 commented 1 year ago

Hey, thanks for answering!

Trying with 0.2.2 still returns the same error for me. It's weird, it only occurs for some components. Avatar doesn't work, Button does work.

dan5py commented 1 year ago

@MattEagle95 I tried to replicate the issue but without success. Seems like a problem related to your connection.

MattEagle95 commented 1 year ago

I tried today, it works now, I'm sorry I'm not sure what the issue was. "Connection Timeout" suggested a client error but since some components worked for me I wanted to try and search for error here :D

Thanks for your help!

dan5py commented 1 year ago

No problem. Here to help 😀

amirhossein-ix commented 9 months ago

mine still doesn't work, i hope it works when i try tomorrow

yqz945 commented 9 months ago

I have the same problem. I clean the npx cache but not work. FetchError: request to https://ui.shadcn.com/registry/index.json failed, reason: connect ETIMEDOUT 76.76.21.98:443 at ClientRequest. (file:///C:/Users/Lenovo/AppData/Local/npm-cache/_npx/125ee17d583c4e03/node_modules/node-fetch/src/index.js:108:11) at ClientRequest.emit (node:events:517:28) at TLSSocket.socketErrorListener (node:_http_client:501:9) at TLSSocket.emit (node:events:517:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { type: 'system', errno: 'ETIMEDOUT', code: 'ETIMEDOUT', erroredSysCall: 'connect' } Failed to fetch components from registry.

Mecil9 commented 9 months ago

as same.how to fix it?

Melrain commented 8 months ago

same here, i'm using proxy

chaocwu commented 8 months ago

me too. shadcnui

kangood commented 8 months ago

How to solve it? I've been stuck here

amirhossein-ix commented 8 months ago

How to solve it? I've been stuck here

not a fix but the only way i found was to manually install the packages.

aliashraficrypto commented 8 months ago

mine still doesn't work

DrewIndeed commented 8 months ago

I just tried my VPN (Singapore) and it just worked =)) this is weird as hell. Maybe the connection problem @dan5py said is real?? Idk

Aleksandr-Karikov commented 8 months ago

image same(

Siajey commented 8 months ago

hi i had the same problem just a few sec ago and i just read the comments , i try this command npx shadcn-ui@latest add avatar --overwrite now i got the avatar perfectly fine thank you

rihanna57 commented 7 months ago

hi everybody,I also have the same bug, what is your suggestion for solving problem.

amirhossein-ix commented 7 months ago

you can either a vpn or change your vpn ( in my case windscribe worked ), or you can just install the packages manually, the instructions are on their documents.

Cat-The-Developer commented 4 months ago

I tried 2-3 times and it works on 2nd or 3rd try. I even know how but it works

nepimentel commented 4 months ago

npx shadcn-ui init
FetchError: request to https://ui.shadcn.com/registry/styles/index.json failed, reason: self-signed certificate in certificate chain at ClientRequest. at ClientRequest.emit (node:events:514:28) at TLSSocket.socketErrorListener (node:_http_client:495:9) at TLSSocket.emit (node:events:514:28) at emitErrorNT (node:internal/streams/destroy:151:8) at emitErrorCloseNT (node:internal/streams/destroy:116:3) at process.processTicksAndRejections (node:internal/process/task_queues:82:21) { type: 'system', errno: 'SELF_SIGNED_CERT_IN_CHAIN', code: 'SELF_SIGNED_CERT_IN_CHAIN', erroredSysCall: undefined } Failed to fetch styles from registry.

MhL5 commented 2 months ago

image

[!TIP] Incorrect System Date and Time can cause TLS handshake failures.

same issue

renzonj commented 2 months ago

Are you by any chance using ESET Antivirus?

https://forum.eset.com/topic/40702-eset-ssl-protection-produces-an-invalid-certificate-chain-for-nodejs-apps/

MhL5 commented 2 months ago

I don't use any antivirus it's weird Sometimes it works, and sometimes it fails🤔

kouroshey commented 2 months ago

same here. Sometimes it works, and sometimes it fails

wuqianrui commented 2 months ago

I was following the documentation at https://ui.shadcn.com/docs/installation. After initializing the components.json with npx shadcn-ui@latest init I ran npx shadcn-ui@latest add and selected all components. It returns the error: "Failed to fetch tree from registry." - ERR_SOCKET_CONNECTION_TIMEOUT.

Using the command with a component npx shadcn-ui@latest add avatar does only work for some components, for others like "avatar", "command", "toggle" I get the same error.

I tried style: default and style: new-york.

Tried commands:

npx shadcn-ui@latest add (select all components)
npx shadcn-ui@latest add avatar
npx shadcn-ui@latest add avatar --overwrite
npx shadcn-ui@latest add avatar, ...

Error:

FetchError: request to https://ui.shadcn.com/registry/styles/new-york/avatar.json failed, reason: Socket connection timeout
    at ClientRequest.<anonymous> (file:///C:/Users/matteagle95/AppData/Local/npm-cache/_npx/125ee17d583c4e03/node_modules/node-fetch/src/index.js:108:11)
    at ClientRequest.emit (node:events:511:28)
    at TLSSocket.socketErrorListener (node:_http_client:495:9)
    at TLSSocket.emit (node:events:511:28)
    at emitErrorNT (node:internal/streams/destroy:151:8)
    at emitErrorCloseNT (node:internal/streams/destroy:116:3)
    at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
  type: 'system',
  errno: 'ERR_SOCKET_CONNECTION_TIMEOUT',
  code: 'ERR_SOCKET_CONNECTION_TIMEOUT',
  erroredSysCall: undefined
}
Failed to fetch tree from registry.

OS/Project: OS: Windows 10 NextJS: 13.4.1

我解决了

wuqianrui commented 2 months ago

My operating environment is Windows. I used Google to look up the IP address for https://www.shadcn-vue.com/registry/styles/index.json and found it to be 104.21.17.226 . and I edited the hosts file on my Windows computer, adding the line:

104.21.17.226 www.shadcn-vue.com

With this addition, the configuration takes effect locally for me; however, some Windows devices might require a restart for the changes in the hosts file to be applied.

Side note: As a Chinese person, dealing with these sorts of network issues can often be quite draining.

Shazzad998 commented 2 months ago

I had the same issue. I had to change my region on my windows machine to the correct one according to my location and that solved the error for me.

girmafetene commented 2 months ago

Upgrade Node Module

girmafetene commented 2 months ago

And Stope visual studio Code Run

RucksollyTech commented 1 month ago

Keep retrying, it will eventually work. I got the same error I waited for a while and tried again and it worked.

youwei997 commented 1 month ago

My operating environment is Windows. I used Google to look up the IP address for https://www.shadcn-vue.com/registry/styles/index.json and found it to be 104.21.17.226 . and I edited the hosts file on my Windows computer, adding the line:

104.21.17.226 www.shadcn-vue.com

With this addition, the configuration takes effect locally for me; however, some Windows devices might require a restart for the changes in the hosts file to be applied.

Side note: As a Chinese person, dealing with these sorts of network issues can often be quite draining.

Awesome! This UI library is really speechless.

Pomelo1213 commented 6 days ago

i reboot my terminal, and open proxy ,it fixed! i do not get the point.