Closed hubcio2115 closed 9 months ago
After some digging I figured that the issue might be with this utility:
export async function transformByDetype(content: string, filename: string) {
return await transform(content, filename, {
removeTsComments: true,
})
}
It can't convert extended interface. Maybe changing this to a type
syntax'd solve the issue? I can't easily test it since the cli is making a fetch request to the components registry.
I managed to get the component finally by moving PrimitiveProps
properties to Props
. With that I was able to build the Button
component.
Thanks for the context @hubcio2115 ! I think you are right that the transformation may be causing that issue.
@Dunqing can you help look into this? 😁 Believe it might be related to detypes
Thanks for the context @hubcio2115 ! I think you are right that the transformation may be causing that issue. @Dunqing can you help look into this? 😁 Believe it might be related to
detypes
I'll look into that
I had the exact same problem/errormsg, when I installed typescript in the project it worked
...when I installed typescript in the project it worked
I also have typescript installed because it's a needed dependency in a project for Volar to work. At least for me it's needed with the setup I have.
Sorry, it took so long to respond.
I cannot reproduce in your reproduction. Judging from the error message, your @vue/compiler-sfc
package version is below v3.2. But the detypes
package requires @vue/*
>= 3.2
. So you can upgrade these packages and try again
Yes I can confirm it is working on Windows and also unix OS (StackBlitz)
https://stackblitz.com/edit/github-w623yc ignore this warn for now (WARN Two component files resolving to the same name UiButton)
However on Windows on first try I had error but after first try it work as excepted
pnpm dlx shadcn-vue@latest add button
❌ pnpm dlx shadcn-vue@latest add
and select the components ✅ pnpm dlx shadcn-vue@latest add button
✅ Please try on latest Nuxt and Vue versions, don't stay on older versions when it's not like Vue2->Vue3 migration
I'm also getting this error while adding button. I just setup an vue project using js and I cannot add button to my project. Here is the link to the codespace https://codespaces.new/Jahan-Shah/test
Is there any solution?
Note: The issue resolved after I installed radix-vue.
Since button is using PrimitiveProps
types
radix-vue
must be present in dependencies
Main shadcn-ui CLI also install @radix-ui/react-slot
when adding Button
component
Ow man You guys are right 👍
Adding radix-vue
dep with shadcn init
before adding any component with shadcn-vue add
should resolve this issue
@sadeghbarati I'm glad that helped in resolving the issue.
I'm still getting this error when I follow Nuxt guide: https://www.shadcn-vue.com/docs/installation/nuxt.html
I also tried installing radix-vue first and later executing npx shadcn-vue@latest init
but still gettting the error with button component.
I'm still getting this error when I follow Nuxt guide: https://www.shadcn-vue.com/docs/installation/nuxt.html
I also tried installing radix-vue first and later executing
npx shadcn-vue@latest init
but still gettting the error with button component.
Same error. How to resolve it?
I've got the same issue on a new Nuxt project. Tried adding radix-vue
as a dev dependecy, but that didn't resolve the issue.
@ayaanqui Hi
Are you using shadcn-vue
without TypeScript?
@ayaanqui Hi
Are you using
shadcn-vue
without TypeScript?
@sadeghbarati I'm using it with TS. Also, I was able to fix the issue on my end by adding an import to the button component. Looks like the auto import feature offered in Nuxt didn't work.
I have the same problem with typescript
please solve that
Hi, Can you guys share what way you using shadcn-vue in Nuxt?
Or
Hello I have created a new project in NUXT3, I followed the instructions and I am still getting this error when using the button component. I selected the typescript option. Is there any temporary fix?
My fault sorry, typescript wasn't installed as a dependency:
npm install -D typescript
Now everything works
So we tested with TypeScript
and also tested out without TypeScript
here 👇
https://stackblitz.com/edit/vitejs-vite-1tta2g
It's working fine
still having this issue when using the default nuxt layer setup: ENOENT: no such file or directory, stat 'D:/Code/Nuxt Component Layer - Test/nuxt-layer/.nuxt/tsconfig.json'
Hi, I'm trying to use it in a Laravel project without typescript. It is not working for me also. it looks like the init command didn't installed the basic dependencies. I attached package.json after installing shadcn. should I manually install required dependencies?
@usmanibrahim74
You need to remove lockfile and install again, then run shadcn-vue init again
Or just install missing dependencies manually
Idk why it's happening, but I know sometimes lockfiles are the problems
@usmanibrahim74
You need to remove lockfile and install again, then run shadcn-vue init again
Or just install missing dependencies manually
Idk why it's happening, but I know sometimes lockfiles are the problems
thanks, dude. it works!
Got that error too now. Fresh install of shadcn using the recommended npx nuxi@latest module add shadcn-nuxt
I tried updating @vue/compiler-sfc and installing updating 'radix-vue' manually but that didnt change anything.
I now added the by the compiler proposed interface Props extends /* @vue-ignore */ PrimitiveProps {
and it works but yeah doesn't feel like a correct solution.
"nuxt": "^3.11.2",
"shadcn-nuxt": "^0.10.4"
"radix-vue": "^1.8.0",
Been slamming my head against the wall for some days now. Same problem as the original issue, same setup as the previous comment with Nuxt 3.11.2
Using the managed shadcn-nuxt module, and all the default values for the configs.
The error is not specifically for the button component im my case. The same error is thrown for any import of radix component props that uses the primitive props from what ive noticed.
Make sure you install typeScript as a dev dependency
I had the exact same problem/errormsg, when I installed typescript in the project it worked
Thank you ... adding typescript was enough to make it work.
I had the same problem using nuxt + pnpm. I had to install radix-vue and tailwind-merge manually.
Environment
Link to minimal reproduction
https://github.com/hubcio2115/nuxt-chadcn
Steps to reproduce
components/ui
folder insrc
- because you cannot commit empty folders with gitbun i
bunx schadcn-vue-@latest add button
Describe the bug
I started a brand new project with
nuxti
, as per shadcn-vue instructions for js setup in the installation docs. Went through entire process and when I try to addbutton
with the cli I get:button
folder gets added insrc/components/ui
but it doesn't get populated with thebutton
component. It is specificallybutton
component. When I tried to addinput
,badge
andalert
it worked just fine. When I tried to installchadcn-vue
in a typescript nuxt project installingbutton
works fine.Expected behavior
chadcn-vue
Button component gets added tosrc/components/ui
with it'sindex.js
file.Conext & Screenshots (if applicable)
No response