shadcn-ui / ui

Beautifully designed components that you can copy and paste into your apps. Accessible. Customizable. Open Source.
https://ui.shadcn.com
MIT License
75.43k stars 4.73k forks source link

[bug]: Unable to install on Laravel 11.x #4789

Open beysach opened 2 months ago

beysach commented 2 months ago

Describe the bug

Cannot Install shadcn-ui on Laravel Inertia React while using Javascript .jsx ✔ Preflight checks. ✔ Verifying framework. Found Laravel. ✔ Validating Tailwind CSS. ✖ Validating import alias.

No import alias found in your tsconfig.json file. Visit https://ui.shadcn.com/docs/installation/laravel to learn how to set an import alias.

Affected component/components

npx shadcn@latest init

How to reproduce

npx shadcn@latest init

Codesandbox/StackBlitz link

No response

Logs

No response

System Info

Windows 10 x64

Before submitting

kkarkos commented 2 months ago

You need to add

 "paths": {
      "@/*": ["./*"]
    }

To your tsconfig. So shadcn can use @ for imports.

beysach commented 2 months ago

You need to add

 "paths": {
      "@/*": ["./*"]
    }

To your tsconfig. So shadcn can use @ for imports.

I mean, when the project is first initialized, tsconfig and jsconfig haven't been created yet.

Lorh-o commented 2 months ago

Having this issue aswell, I cant even create a laravel project following shadcn's documentation.

https://ui.shadcn.com/docs/installation/laravel

Tells me I cant use --typescript and when I install it manually I get that issue

raviMukti commented 2 months ago

same here, the issue still persist, any solution about this?

raviMukti commented 2 months ago

I found the solution: you need to first create a tsconfig.json file in the project root, and then run the installation command

{
  "compilerOptions": {
    "paths": {
        "@/*": ["./*"]
    }
  }
}

then run the command npx shadcn@latest init

image

Mesele-shishay commented 1 month ago

This Worked to me Thanks Dude.

iamtheuri commented 1 day ago

Thanks @raviMukti. Worked for me