ui icon indicating copy to clipboard operation
ui copied to clipboard

[bug]: Error adding shadcn for Turborepo

Open gauravnepal3 opened this issue 10 months ago • 10 comments

Describe the bug

Unable to add shadcn using turborepo.

npx shadcn@canary init

✔ Preflight checks. ✖ Verifying framework.

We could not detect a supported framework at /app-name. Visit https://ui.shadcn.com/docs/installation/manual to manually configure your project. Once configured, you can use the cli to add components.

Affected component/components

Not installing

How to reproduce

  1. Create monorepo using turborepo
  2. Run shadcn/ui CLI to add for monorepo

Codesandbox/StackBlitz link

No response

Logs


System Info

System, pnpm

Before submitting

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

gauravnepal3 avatar Jan 22 '25 15:01 gauravnepal3

I think you're doing it backwards, try without creating the turborepo.

In the docs it says running the pnpm dlx shadcn@canary init command will prompt you to select Next.js (Monorepo) which I assume will create the turborepo in its build process.

lloydrichards avatar Jan 26 '25 17:01 lloydrichards

I think you're doing it backwards, try without creating the turborepo.

In the docs it says running the pnpm dlx shadcn@canary init command will prompt you to select Next.js (Monorepo) which I assume will create the turborepo in its build process.

This dosent works either.

it just fails!

➜  ~ pnpm dlx shadcn@canary init 
✔ The path /home/kedar does not contain a package.json file.
  Would you like to start a new project? › Next.js (Monorepo)
✔ What is your project named? … my-app
✖ Something went wrong creating a new Next.js monorepo.
Something went wrong. Please check the error below for more details.
If the problem persists, please open an issue on GitHub.

Command failed with ENOENT: cd /home/kedar
spawn cd ENOENT

devWithKD avatar Feb 22 '25 11:02 devWithKD

I found a workaround, not the best way but it worked for me

bunx shadcn@canary init

it will throw error saying bun install failed but the basic structure will have been created by now

then you can cd into your project and run

pnpm install

just make sure you change the pnpm version in pacakage.json to the one you are installing.

Its the only way i came across to initiate project.

FYI idk why

pnpm dlx shadcn@canary init

works perfectly on macOS only idk whats wrong on linux or windows


Edit:

pnpm dlx shadcn@canary init

this works in windows CMD too but if i run that on gitbash it fails

devWithKD avatar Feb 23 '25 14:02 devWithKD

@devWithKD Worked in cmd for me as well

zocsen avatar Mar 19 '25 10:03 zocsen

same issue.

yokeTH avatar Aug 01 '25 03:08 yokeTH

same issue.

dev-sumanaditya avatar Aug 22 '25 12:08 dev-sumanaditya

same

pavelsavva avatar Sep 19 '25 05:09 pavelsavva

same

amirho1 avatar Sep 27 '25 13:09 amirho1

same

sins621 avatar Oct 02 '25 16:10 sins621

same

JakubGluszek avatar Nov 10 '25 13:11 JakubGluszek