ui icon indicating copy to clipboard operation
ui copied to clipboard

CLI - Fetch Error when requesting neutral base color

Open ideakaran opened this issue 1 year ago • 12 comments

I have a next.js app and I am trying to use shadcn-ui in my app. I hit the command "npx shadcn-ui@latest init" in the terminal and answered all the configuration question but I am getting the following error.

npx shadcn-ui@latest init √ Would you like to use TypeScript (recommended)? ... no / yes √ Which style would you like to use? » New York √ Which color would you like to use as base color? » Neutral √ Where is your global CSS file? ... app/globals.css √ Would you like to use CSS variables for colors? ... no / yes √ Where is your tailwind.config.js located? ... tailwind.config.js √ Configure the import alias for components: ... @/components √ Configure the import alias for utils: ... @/lib/utils √ Are you using React Server Components? ... no / yes √ Write configuration to components.json. Proceed? ... yes

✔ Writing components.json... ⠸ Initializing project...FetchError: request to https://ui.shadcn.com/registry/colors/neutral.json failed, reason: connect ETIMEDOUT 76.76.21.61:443 at ClientRequest. (file:///C:/Users/FullStack/AppData/Local/npm-cache/_npx/125ee17d583c4e03/node_modules/node-fetch/src/index.js:108:11) at ClientRequest.emit (node:events:514:28) at TLSSocket.socketErrorListener (node:_http_client:501: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: 'ETIMEDOUT', code: 'ETIMEDOUT', erroredSysCall: 'connect' } Failed to fetch base color from registry.

If I open the url ("https://ui.shadcn.com/registry/colors/neutral.json"), in my browser, then I get the json configuration response.

My Operating System is Windows 11 and next is"13.4.19".

ideakaran avatar Aug 31 '23 12:08 ideakaran

Hmm is this still happening for you?

shadcn avatar Aug 31 '23 17:08 shadcn

Maybe this will help you... currently Next.js creates the tailwind.config.ts file if you choose TS when creating your project, but shadcn-ui keeps creating tailwind.config.js when you implement it. So you have 2 files with different extensions.

RenzoBA avatar Aug 31 '23 23:08 RenzoBA

Now, it's working. I don't know why it behaved that way but today it is working.

ideakaran avatar Sep 01 '23 16:09 ideakaran

I got the same

toannguyen3105 avatar Sep 02 '23 01:09 toannguyen3105

Reopened this issue as, still facing smiliar issue. This time I am getting following error

npx shadcn-ui@latest add √ Which components would you like to add? » accordion, alert, alert-dialog, aspect-ratio, avatar, badge, button, calendar, card, checkbox, collapsible, command, context-menu, dialog, dropdown-menu, form, hover-card, input, label, menubar, navigation-menu, popover, progress, radio-group, scroll-area, select, separator, sheet, skeleton, slider, switch, table, tabs, textarea, toast, toggle, tooltip FetchError: request to https://ui.shadcn.com/registry/styles/new-york/card.json failed, reason: connect ETIMEDOUT 76.76.21.22:443 at ClientRequest. (file:///C:/Users/FullStack/AppData/Local/npm-cache/_npx/125ee17d583c4e03/node_modules/node-fetch/src/index.js:108:11) at ClientRequest.emit (node:events:514:28) at TLSSocket.socketErrorListener (node:_http_client:501: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: 'ETIMEDOUT', code: 'ETIMEDOUT', erroredSysCall: 'connect' } Failed to fetch tree from registry.

However, If i hit the url(https://ui.shadcn.com/registry/styles/new-york/card.json) in browser, I get the response. So, not really sure why it's saying ETIMEDOUT.

ideakaran avatar Sep 02 '23 15:09 ideakaran

Let me see if I can reproduce.

shadcn avatar Sep 02 '23 18:09 shadcn

Had same issue. Restarted my system and all seems fine

coderismaila avatar Sep 05 '23 01:09 coderismaila

@coderismaila i did the same and it also worked fine. Thanks!

kalbaevv avatar Sep 08 '23 04:09 kalbaevv

What works for me: npx shadcn-ui@latest init

My issue is caused by "baseColor": "blue", which was changed from "slate", in components.json'. Hope it helps.

profcoconut avatar Sep 18 '23 14:09 profcoconut

@coderismaila yes worked for me too. Restarting actually solves the error.

Ngash01 avatar Oct 25 '23 18:10 Ngash01

This is caused by a mismatch between your theme colours and the colour that is defined in components.json file.

faeztgh avatar Nov 15 '23 04:11 faeztgh

npx shadcn-ui@latest init

√ Which color would you like to use as base color? » Slate √ Would you like to use CSS variables for colors? ... no / yes

✔ Writing components.json... ✔ Initializing project... ⠹ Installing dependencies...Command failed with exit code 1: npm install tailwindcss-animate class-variance-authority clsx tailwind-merge lucide-react npm ERR! code ERR_SOCKET_CONNECTION_TIMEOUT npm ERR! errno ERR_SOCKET_CONNECTION_TIMEOUT npm ERR! request to https://registry.npmjs.org/tailwindcss-animate failed, reason: Socket connection timeout

npm ERR! A complete log of this run can be found in: C:\Users\LENOVO\AppData\Local\npm-cache_logs\2024-03-10T16_54_06_305Z-debug-0.log

vidzshan avatar Mar 10 '24 17:03 vidzshan

This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.

shadcn avatar Jun 29 '24 23:06 shadcn