-
-
Notifications
You must be signed in to change notification settings - Fork 8k
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
I have setup a monorepo with shadcn and it has been working great so far. The one issue I have found is that the <Sidebar /> component cannot be added via the CLI when in a monorepo.
When I run, for example npx shadcn@latest add alert everything is fine:
However, when I run npx shadcn@latest add sidebar I get an error related to incorrect path resolution from the mappings of the folders in the workspace:
This is the contents of the components.json file in the packages/ui directory:
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "new-york",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "@repo/tailwind-config/tailwind.config.ts",
"css": "@repo/tailwind-config/globals.css",
"baseColor": "neutral",
"cssVariables": true
},
"iconLibrary": "lucide",
"aliases": {
"components": "@repo/ui/components",
"utils": "@repo/ui/lib/utils",
"hooks": "@repo/ui/hooks",
"lib": "@repo/ui/lib",
"ui": "@repo/ui/components"
}
}
And this is the components.json of the apps/web directory:
{
"$schema": "https://ui.shadcn.com/schema.json",
"style": "default",
"rsc": true,
"tsx": true,
"tailwind": {
"config": "@repo/tailwind-config/tailwind.config.ts",
"css": "app/globals.css",
"baseColor": "slate",
"cssVariables": true,
"prefix": ""
},
"aliases": {
"components": "~/components",
"utils": "@repo/ui/lib/utils",
"ui": "@repo/ui/components",
"lib": "~/lib",
"hooks": "~/hooks"
},
"iconLibrary": "lucide"
}Affected component/components
sidebar
How to reproduce
- Setup a monorepo
- cd into the web app
- run
npx shadcn@latest add sidebar
Codesandbox/StackBlitz link
No response
Logs
System Info
System is macOS 14.6.1 (23G93)
Node v20.12.2Before submitting
- I've made research efforts and searched the documentation
- I've searched for existing issues
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working

