Clone the repo and run OR you can open it in Gitpod too from the button below.
Proposed Changes
Update the CLI default for "Where is your global CSS file?" to src/app/globals.css from app/globals.css
Steps to reproduce
run npx create-next-app@latest shadcnui-cli-bug --typescript --tailwind --eslint and press enter to choose all the defaults.
✔ Would you like to use src/ directory? … No / Yes
✔ Would you like to use App Router? (recommended) … No / Yes
✔ Would you like to customize the default import alias (@/*)? … No / Yes
cd into your project. cd shadcnui-cli-bug/
run npx shadcn-ui@latest init and press enter to choose all the defaults.
✔ Would you like to use TypeScript (recommended)? … no / yes
✔ Which style would you like to use? › Default
✔ Which color would you like to use as base color? › Slate
✔ Where is your global CSS file? … app/globals.css
✔ Would you like to use CSS variables for colors? … no / yes
✔ Are you using a custom tailwind prefix eg. tw-? (Leave blank if not) …
✔ Where is your tailwind.config.js located? … tailwind.config.js
✔ Configure the import alias for components: … @/components
✔ Configure the import alias for utils: … @/lib/utils
✔ Are you using React Server Components? … no / yes
✔ Write configuration to components.json. Proceed? … yes
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.
This is a copy of the issue #1821, reproduced the bug
When i initialize shadcn/ui using
npx shadcn-ui@latest init
, the nextjs app gives 404 page on all routes (including '/').This bug is likely to be caused because
globals.css
is being created in the root of the project as reported in the thread of the original issue.I have reproduced this bug(#1821) in lem0n4id/shadcnui-cli-bug.
Clone the repo and run OR you can open it in Gitpod too from the button below.
Proposed Changes
Update the CLI default for "Where is your global CSS file?" to
src/app/globals.css
fromapp/globals.css
Steps to reproduce
run
npx create-next-app@latest shadcnui-cli-bug --typescript --tailwind --eslint
and press enter to choose all the defaults. ✔ Would you like to usesrc/
directory? … No / Yes ✔ Would you like to use App Router? (recommended) … No / Yes ✔ Would you like to customize the default import alias (@/*)? … No / Yescd into your project.
cd shadcnui-cli-bug/
run
npx shadcn-ui@latest init
and press enter to choose all the defaults. ✔ Would you like to use TypeScript (recommended)? … no / yes ✔ Which style would you like to use? › Default ✔ Which color would you like to use as base color? › Slate ✔ Where is your global CSS file? … app/globals.css ✔ Would you like to use CSS variables for colors? … no / yes ✔ Are you using a custom tailwind prefix eg. tw-? (Leave blank if not) … ✔ Where is your tailwind.config.js located? … tailwind.config.js ✔ Configure the import alias for components: … @/components ✔ Configure the import alias for utils: … @/lib/utils ✔ Are you using React Server Components? … no / yes ✔ Write configuration to components.json. Proceed? … yesrun
npm run dev
▲ Next.js 14.0.4
✓ Ready in 2.6s ○ Compiling /not-found ... ✓ Compiled /not-found in 2.9s (395 modules)
Output