ui: Cant install on a Js project

i keep getting this error everytime i try to install on my non-ts project

Failed to load tsconfig.json. Couldn't find tsconfig.json

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Reactions: 5
  • Comments: 18 (3 by maintainers)

Most upvoted comments

Found the issue You need to add a jsconfig.json to the file to mention the alias paths if you have a need to support any

For eg.

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

The error message needs to be updated to specify missing jsconfig.js file instead of tsconfig.json file when tsx is false in components.json file

I ran into this issue as well with a non-TS project. I manually added a tsconfig.json file at the root of the project and inserted the block of code provided in step 4 of the manual instructions. Then I ran the init command npx shadcn-ui@latest init and stepped through the questions - specifying ‘no’ to the “Would you like to use TypeScript (recommended)?” questions. When I installed the Badge component, it added a .jsx file into components/ui dir.

Hello @Namnika @prashantchhonker ,i assume you are using react js. I have been using shadcn at my own js react vite project too, you can use my starter repo if you like. https://github.com/spiritoftime/shadcn-reactjs-starter

Thanks everyone, I now fully use typescript lol.

I am facing the same issue. I am following the installation instructions to the dot. Which means running the following commands.

npx create-next-app@latest nextjs-test --typescript --tailwind --eslint
npx shadcn-ui@latest init
npx shadcn-ui@latest add button

Hello @Namnika @prashantchhonker ,i assume you are using react js. I have been using shadcn at my own js react vite project too, you can use my starter repo if you like. https://github.com/spiritoftime/shadcn-reactjs-starter

Thanks 😃

@spiritoftime Thank you so much for sharing the repo link! 😃 And I tried to do it with customization of React + Vite + shandcn which worked well.

Thanks All of the way!