Shadcn error module not found: Error: Can't resolve '@/components/ui/accordion' in 'Desktop/sadcn/src'

877 views Asked by At

i am using shadcn with simple react app with typescript installed but i'm getting this error

module not found: Error: Can't resolve '@/components/ui/accordion' in '/home/vinayak/Desktop/sadcn/src'

i have installed it using shadcn cli and kept typescript component option as no so i get jsx components only every time.

here is my tsconfig file ::

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

Here is my project tree

- .gitignore
- README.md
- app
  - globals.css
- components
  - ui
    - accordion.jsx
- components.json
- lib
  - utils.js
- package-lock.json
- package.json
- public
  - favicon.ico
  - index.html
  - logo192.png
  - logo512.png
  - manifest.json
  - robots.txt
- src
  - App.css
  - App.js
  - App.test.js
  - index.css
  - index.js
  - logo.svg
  - reportWebVitals.js
  - setupTests.js
- tailwind.config.js
- tsconfig.json

How to fir it ??

1

There are 1 answers

0
Tebogo sizwe Mohale On

I resolved this issue. Put this on your terminal :

  • npm install shadcn-ui@latest
  • npm install npx shadcn-ui@latest init