Open philliphartin opened 4 months ago
@philliphartin JS or TS project?
It was a TS project (Nuxt)
Same here on nuxt project(tried npm
, pnpm
, bun
), I think this is a bug of v0.10.5.
When I follow documentation using npx shadcn-vue@latest add label
it shows below success message.
√ Component button already exists. Would you like to overwrite? ... yes ✔ Done.
but cannot find files in components/ui
directory.
npx shadcn-vue@v0.10.4 add label
works fine.
Same problem.
npx shadcn-vue@v0.10.4 add label
works fine.
same using node v20.13.1
Same here
Same issue for me with Nuxt and shadcn-vue@latest. Works fine with v0.10.4
Hey guys.. I've just tested on Stackblitz using v0.10.5 and latest Nuxt, seems to be fine tho 🤔 https://stackblitz.com/edit/github-iqfvjd?file=package.json
Maybe it only happens on Windows? I'm not sure what environment StackBlitz uses.
Tested on Windows 11 it's working with v0.10.5
Nuxt/TS project
Tested on Windows 11 it's working with
v0.10.5
Indicates success and the component is downloaded to the desktop, and not to the project (Windows 10)
If you are in Nuxt/JS project this issue might help (component added outside of the project directory)
https://github.com/radix-vue/shadcn-vue/issues/291#issuecomment-1901788144
If you are in Nuxt/JS project this issue might help (component added outside of the project directory)
For my case (Nuxt/TS) the components were being added to the parent dir, this solution did fix the issue with detecting root dir.
If you are in Nuxt/JS project this issue might help (component added outside of the project directory) #291 (comment)
For my case (Nuxt/TS) the components were being added to the parent dir, this solution did fix the issue with detecting root dir.
Did not fix the issue for me.
@diakonovm can you share what kind of error message you got? We need more details in what is the root cause of this issue
If you are in Nuxt/JS project this issue might help (component added outside of the project directory)
Got the same problem as well and this did not work for me but I was able to make it work by deleting the node_modules
folder then re-run pnpm install
. After that, I was able to download the component.
Hope this solve your problem as well.
Nuxt: 3.11.2 Shadcn-nuxt: 0.10.4 Node: v22.2.0 pnpm: 9.0.5
I've been finding the same as the above.
Neither the linked #291 nor deleting the node_modules
fixed it.
As above, when I run npx shadcn-vue@latest add sonner tooltip
the CLI still runs, it says it is successful ... but now the component is no longer installed in the /components/ui
folder (with the rest) but instead get added to the parent folder, in a newly created sibling components/ui
folder. Weird! For now I have just manually moved them and then deleted that folder.
Nuxt app, on a Mac, using npm.
Just tried it again and it only works when https://github.com/radix-vue/shadcn-vue/issues/291#issuecomment-1901788144 is added to the nuxt.config.ts
then deleting the node_modules
and running pnpm install
If you are in Nuxt/JS project this issue might help (component added outside of the project directory) #291 (comment)
For my case (Nuxt/TS) the components were being added to the parent dir, this solution did fix the issue with detecting root dir.
This seems to work
@kawoki Ah ... yes! Thanks. The order matters.
Daniel Roe quote
There are a number of reasons we choose not to set baseURL, including the fact that typescript recommends against it. Let's see if we can fix the upstream issue another way.
i made an npm command that moves the folders for windows. //package.json
"shadcnmove": "robocopy \"C:\\Users\\USER_NAME\\code\\components\\ui\" \"C:\\Users\\USER_NAME\\code\\PROJECT_NAME\\components\\ui\" /move /e",
after install i run npm run shadcnmove
For those who are using Nuxt, I fixed it by setting the tsConfigPath
in components.json. Here is my new config.
{
"$schema": "https://shadcn-vue.com/schema.json",
"style": "default",
"typescript": true,
"tsConfigPath": ".nuxt/tsconfig.json",
"tailwind": {
"config": "tailwind.config.js",
"css": "assets/css/tailwind.css",
"baseColor": "stone",
"cssVariables": true
},
"framework": "nuxt",
"aliases": {
"components": "@/components",
"utils": "@/utils/cn",
"ui": "@/components/ui"
}
}
And as an extra information, we should set the aliases.ui
in components.json, if we want to change where the components should be placed. The componentsDir
in nuxt.config.ts is for the auto import.
shadcn: {
prefix: '',
componentDir: './components/ui',
},
For those who are using Nuxt, I fixed it by setting the
tsConfigPath
in components.json. Here is my new config.{ "$schema": "https://shadcn-vue.com/schema.json", "style": "default", "typescript": true, "tsConfigPath": ".nuxt/tsconfig.json", "tailwind": { "config": "tailwind.config.js", "css": "assets/css/tailwind.css", "baseColor": "stone", "cssVariables": true }, "framework": "nuxt", "aliases": { "components": "@/components", "utils": "@/utils/cn", "ui": "@/components/ui" } }
And as an extra information, we should set the
aliases.ui
in components.json, if we want to change where the components should be placed. ThecomponentsDir
in nuxt.config.ts is for the auto import.shadcn: { prefix: '', componentDir: './components/ui', },
Fixed it for me too, thank you! I had tsconfig.json
instead of .nuxt/tsconfig.json
, because tsconfig.json
extends .nuxt/tsconfig.json
.
Adding the following to nuxt.config.ts worked for me
components: [
{ path: './components', prefix: 'V' },
],
Reproduction
Use the CLI
Describe the bug
Since the latest release the
npx shadcn-vue@latest add tabs
helper no longer works. Currently using0.10.4
to keep functionality going.System Info
Contributes