ui
ui copied to clipboard
Shadcn not working in NextJS
Whenever I write this command after installing chad-cn while building a next-js project, I always encounter this error and chad-cn doesn't get initialised--
node:internal/modules/esm/resolve:214 const resolvedOption = FSLegacyMainResolve(packageJsonUrlString, packageConfig.main, baseStringified); ^
Error: Cannot find package 'C:\Users\piyush\AppData\Local\npm-cache_npx\125ee17d583c4e03\node_modules\wcwidth\package.json' imported from C:\Users\piyush\AppData\Local\npm-cache_npx\125ee17d583c4e03\node_modules\ora\index.js
at legacyMainResolve (node:internal/modules/esm/resolve:214:26)
at packageResolve (node:internal/modules/esm/resolve:840:14)
at moduleResolve (node:internal/modules/esm/resolve:910:20)
at defaultResolve (node:internal/modules/esm/resolve:1130:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:396:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:365:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:240:38)
at ModuleWrap.
Node.js v21.4.0
I have already tried many fixes but it is still not working, reinstalled nodejs and still it didnt worked.
Have you followed the steps mentioned here? Try to start a new project while following the same steps.
Yes I followed all the steps given here
What version of NextJS are you using? I followed the steps in the docs and it works for me. Also want to confirm your typing "shadcn-ui" and not "chadcn-ui" for the commands?
This issue has been automatically closed because it received no activity for a while. If you think it was closed by accident, please leave a comment. Thank you.
ive resolved this issue.put this on your terminal npm install shadcn-ui@latest and then npm install npx shadcn-ui@latest init it will start to work
that worked for me