Currently viewing the human version
Switch to AI version

What Actually Breaks During Setup

Developer Terminal

Node.js Logo

The shadcn/ui docs make this look easy. It's fucking not. Here's what will go wrong and how to fix it without losing your mind.

What You Actually Need

The CLI randomly shits the bed, so you need backups:

  • Node 18 or newer (18.17+ specifically - 18.16 breaks on Windows)
  • pnpm (npm gives you dependency hell, trust me on this)
  • VS Code with TypeScript extension (you'll restart it every 10 minutes)
  • Coffee or whiskey (this will take 3 hours, not 30 minutes like the docs claim)

Check your setup:

node --version  # Needs to be 18.17+ - 18.16 throws EACCES errors
pnpm --version  # Get this or suffer through npm's broken peer deps

Make sure you have Node.js 18.17+. Yeah, the shadcn docs say 16 works, but I've debugged too many "Cannot resolve module" errors caused by Node 16's busted ESM handling. Get pnpm because npm's dependency resolution completely breaks with React 19 - you'll get peer dependency warnings that make no sense.

Creating the Next.js Project

create-next-app fails randomly. Network timeouts, registry errors, some bullshit about "permission denied" even when you're running as admin. No idea why. It just does.

Try this first:

npx create-next-app@latest my-app --typescript --tailwind --app

When that inevitably fails with ENOTFOUND or EPERM:

## Clear npm cache first - fixes 60% of weird failures
npm cache clean --force
pnpm create next-app my-app --typescript --tailwind --app

The CLI asks questions. Say yes to Turbopack (it's faster than Webpack). Say no to customizing imports (you'll break TypeScript path mapping). Say yes to ESLint unless you enjoy debugging runtime errors that a linter would catch.

If you get errors, nuke everything and start over. I've wasted entire afternoons trying to debug why create-next-app choked on a perfectly valid project name. rm -rf and starting over saves more time than reading Next.js issue threads where half the solutions don't work.

When Your Dev Server Won't Start

Your first npm run dev will probably shit itself with "Module not found" or "Unable to resolve dependency tree" errors.

Nuclear option that actually works:

cd my-app
rm -rf .next node_modules package-lock.json yarn.lock pnpm-lock.yaml
pnpm install
pnpm run dev

Command Line Interface

Go to http://localhost:3000. If you see the Next.js welcome page, you win. If you get a blank white screen or "This page could not be found", check the terminal - probably some TypeScript error about missing types.

Common failures I've seen:

  • "Error: listen EADDRINUSE :::3000" - something's already running on port 3000, kill it with lsof -ti:3000 | xargs kill
  • "Cannot find module 'next/font'" - you're using an old Next.js version, upgrade to 13.2+
  • "Module parse failed" - usually Windows path separator bullshit, try WSL

Next step: Install shadcn/ui and watch it break in exciting new ways.

shadcn/ui Setup: The Copy-Paste Component Library

Component Development

Tailwind CSS Logo

shadcn/ui is weird - instead of npm installing components, it downloads source code directly into your project. This is weird but it works great for customization, terrible for updates. The philosophy is "copy and paste" not "npm install and pray." It's built on Radix UI (solid headless components) and Tailwind (obviously) so you can actually customize things without wanting to quit programming.

Installing the CLI

cd my-app
npx shadcn@latest init

If you get React 19 peer dependency warnings or "ERESOLVE unable to resolve dependency tree":

npx shadcn@latest init --legacy-peer-deps

The CLI asks a bunch of questions. Just hit enter for everything unless you have strong opinions about color schemes. The defaults work fine. It'll ask about CSS variables vs Tailwind config - choose CSS variables unless you're already deep into Tailwind customization and don't want to change your setup.

When Your Components Look Like Garbage

Your first button will look like unstyled HTML. This is normal and infuriating.

Fix: Check your globals.css import order:

/* This MUST be first or everything breaks */
@import "tailwindcss";

I spent 2 hours debugging this exact issue because my button looked like plain HTML with Times New Roman font. Learn from my pain. This CSS import order issue catches everyone because the docs don't mention it prominently enough.

Installing Your First Components

Start with the basics that actually work:

npx shadcn@latest add button card input

Test it by creating a simple page to see if things are working. If your button looks like plain HTML with no styling, the CSS import is wrong.

React Components

Now you have components. Time to set up dark mode and watch it break in exciting new ways.

Dark Mode: SSR Hydration Hell

Dark Mode Toggle

Dark mode seems simple until you try it. Your app flashes white on every page load, shows the wrong theme for 2 seconds, works perfectly in dev, completely breaks in production.

I deployed this once and got Slack messages at 2am from users complaining about white flashes. One guy said it triggered his migraine. Had to roll back the deployment and spent the next morning figuring out why SSR was serving light theme HTML but client-side JS was applying dark theme classes.

Installing next-themes

next-themes is the only one that actually works with SSR.

## React 19 breaks everything as usual
pnpm add next-themes --legacy-peer-deps

React 19 changed how peer dependencies work and now everything throws warnings. next-themes v0.3.0 technically supports React 19 but npm/pnpm still complain about peer deps. The --legacy-peer-deps flag shuts them up.

Fix the White Flash of Death

Your app flashes white on every load. Here's the fix that actually works:

// app/layout.tsx
export default function RootLayout({ children }) {
  return (
    <html lang="en" suppressHydrationWarning>
      <body>
        <ThemeProvider attribute="class" defaultTheme="system">
          {children}
        </ThemeProvider>
      </body>
    </html>
  )
}

The `suppressHydrationWarning` is basically giving up on proper SSR, but it works. React stops yelling "Warning: Text content did not match. Server: 'light' Client: 'dark'" in the console. This happens because the server doesn't know what theme the user wants, so it renders light theme, then the client JS kicks in and applies dark theme.

Add a Theme Toggle

Create a button that switches themes:

// components/theme-toggle.tsx
"use client"
import { useTheme } from "next-themes"
import { Button } from "@/components/ui/button"

export function ThemeToggle() {
  const { theme, setTheme } = useTheme()
  
  return (
    <Button onClick={() => setTheme(theme === "dark" ? "light" : "dark")}>
      Toggle Theme
    </Button>
  )
}

That's it. Dark mode is now working. Your components will adapt automatically if you used the shadcn/ui CSS setup correctly - basically Tailwind looks for a dark class on the <html> element and applies all the `dark:` variants.

Test it by creating a page with some buttons and toggling between themes. If the theme toggle button doesn't change appearance when you click it, your ThemeProvider probably isn't wrapping your content properly. Been there, done that.

Dark Mode UI Example

Setup Methods: Pick Your Poison

Setup Method

How Fast?

Will It Break?

Pain Level

Use When

CLI Setup

⭐⭐⭐⭐ Usually quick

⭐⭐ Breaks on Windows path limits

⭐⭐ Easy

Starting fresh, feeling lucky

Manual Copy-Paste

⭐ Slow as hell

⭐⭐⭐⭐ Only breaks when you fat-finger imports

⭐⭐⭐⭐ Tedious

You need 2 components max

Starter Templates

⭐⭐⭐⭐⭐ Instant

⭐⭐⭐ Often

⭐ Cake

Learning, prototypes

Existing Project Migration

⭐ Pain

⭐⭐⭐⭐⭐ Always

⭐⭐⭐⭐⭐ Nightmare

Your boss makes you

Frequently Asked Questions

Q

Why does the shadcn CLI break with React 19?

A

React 19 support exists but the CLI still throws tantrums with peer dependency warnings.bashnpx shadcn@latest init --legacy-peer-depsThe CLI will usually offer to add --legacy-peer-deps automatically, but not always.

Q

TypeScript can't find my components

A

VS Code shows red squiggles on @/components/ui/button because TypeScript path mapping is fucked. This always breaks in Next.js 15 with the src directory enabled. I swear I've debugged this exact "Cannot find module '@/components/ui/button'" error more times than I can count.Copy this tsconfig.json exactly:json{"compilerOptions": {"baseUrl": ".","paths": {"@/*": ["./src/*"]}}}Then restart TypeScript: Cmd+Shift+P → "TypeScript: Restart TS Server"You'll do this 20 times. It's normal.

Q

My button looks like unstyled HTML

A

This happens to everyone. Your components look like garbage because Tailwind isn't loading.Check your globals.css:css/* This MUST be first in globals.css */@import "tailwindcss";Nuclear option (works 90% of the time):bashrm -rf .next && npm run devIf that doesn't work, the CLI forgot to import globals.css in your root layout.

Q

Dark mode breaks hydration

A

SSR and themes don't play nice. React complains because it can't guess what theme the user wants.Just suppress the warning:tsx// app/layout.tsx<html lang="en" suppressHydrationWarning> <body> <ThemeProvider attribute="class" defaultTheme="system"> {children} </ThemeProvider> </body></html>It's not elegant, but it works.

Q

Can I use shadcn/ui with Bootstrap?

A

No. shadcn/ui needs Tailwind. You can't run both without everything breaking.If you have an existing Bootstrap project, you'll need to migrate section by section or start fresh.

Q

How do I customize components?

A

Edit the component files directly. They're in src/components/ui/.Want a different button style? Open button.tsx and change the classes. That's the whole point

  • you own the code.
Q

My icons aren't showing up

A

You probably forgot to install lucide-react or you're importing icons wrong.bashnpm install lucide-react --legacy-peer-deps``````tsx// Right wayimport { Check, X } from "lucide-react"// Wrong wayimport Check from "lucide-react/check"

Q

Can I add shadcn/ui to an existing project?

A

Yes, but it's a pain. The CLI will try to overwrite your Tailwind config.Back up your existing config first. I learned this the hard way when the shadcn CLI overwrote my entire Tailwind config and I lost all my custom color palette:bashcp tailwind.config.js tailwind.config.backup.jsnpx shadcn@latest initThen manually merge your custom settings back in. Plan for 2-3 hours if you have custom colors, animations, or plugins. The CLI loves to nuke custom content sections.

Q

Should I use App Router or Pages Router?

A

App Router. Pages Router works but App Router has better TypeScript support and you're less likely to run into weird SSR issues.

Q

How do I update components?

A

You don't. You own the code now. If shadcn/ui releases an update, you manually copy any changes you want.There's an experimental diff command but it's not reliable yet.

🔥Setup ShadCN UI in Next.js 15 #nextjstutorial #shadcnui by Rdrudra99

## Setup ShadCN UI in Next.js 15 Tutorial

This 12-minute video tutorial demonstrates the complete setup process for shadcn/ui with Next.js 15, covering CLI initialization, component installation, and basic usage patterns.

Key topics covered:
- Next.js 15 project creation with Tailwind CSS
- shadcn/ui CLI configuration and initialization
- Installing and using core components
- TypeScript integration and path aliases
- Basic styling and customization

Watch: Setup ShadCN UI in Next.js 15

Why this video helps:
12-minute video that actually shows you what to do instead of just reading about it. Guy knows his stuff and doesn't waste time on fluff.

📺 YouTube

Related Tools & Recommendations

review
Recommended

Vite vs Webpack vs Turbopack: Which One Doesn't Suck?

I tested all three on 6 different projects so you don't have to suffer through webpack config hell

Vite
/review/vite-webpack-turbopack/performance-benchmark-review
100%
howto
Recommended

Migrating CRA Tests from Jest to Vitest

integrates with Create React App

Create React App
/howto/migrate-cra-to-vite-nextjs-remix/testing-migration-guide
97%
integration
Recommended

Build a Payment System That Actually Works (Most of the Time)

Stripe + React Native + Firebase: A Guide to Not Losing Your Mind

Stripe
/integration/stripe-react-native-firebase/complete-authentication-payment-flow
71%
integration
Recommended

I Spent a Weekend Integrating Clerk + Supabase + Next.js (So You Don't Have To)

Because building auth from scratch is a fucking nightmare, and the docs for this integration are scattered across three different sites

Supabase
/integration/supabase-clerk-nextjs/authentication-patterns
66%
howto
Recommended

Deploy Next.js to Vercel Production Without Losing Your Shit

Because "it works on my machine" doesn't pay the bills

Next.js
/howto/deploy-nextjs-vercel-production/production-deployment-guide
62%
tool
Similar content

Radix UI - Headless React Components That Don't Suck

React components that handle the annoying stuff so you can focus on making things look good

Radix UI
/tool/radix-ui/overview
59%
integration
Recommended

SvelteKit + TypeScript + Tailwind: What I Learned Building 3 Production Apps

The stack that actually doesn't make you want to throw your laptop out the window

Svelte
/integration/svelte-sveltekit-tailwind-typescript/full-stack-architecture-guide
58%
tool
Similar content

SvelteKit - Web Apps That Actually Load Fast

I'm tired of explaining to clients why their React checkout takes 5 seconds to load

SvelteKit
/tool/sveltekit/overview
58%
howto
Recommended

Migrate from Webpack to Vite Without Breaking Everything

Your webpack dev server is probably slower than your browser startup

Webpack
/howto/migrate-webpack-to-vite/complete-migration-guide
57%
tool
Recommended

React Router - The Routing Library That Actually Works

depends on React Router

React Router
/tool/react-router/overview
53%
tool
Recommended

React 앱 개느려서 유저들 다 튀는 거 막기

진짜 성능 개선법 (삽질 5년차 경험담)

React
/ko:tool/react/performance-optimization-guide
53%
howto
Recommended

Migrate JavaScript to TypeScript Without Losing Your Mind

A battle-tested guide for teams migrating production JavaScript codebases to TypeScript

JavaScript
/howto/migrate-javascript-project-typescript/complete-migration-guide
50%
integration
Recommended

Deploy Next.js + Supabase + Stripe Without Breaking Everything

The Stack That Actually Works in Production (After You Fix Everything That's Broken)

Supabase
/integration/supabase-stripe-nextjs-production/overview
48%
tool
Recommended

Remix - HTML Forms That Don't Suck

Finally, a React framework that remembers HTML exists

Remix
/tool/remix/overview
47%
compare
Recommended

Remix vs SvelteKit vs Next.js: Which One Breaks Less

I got paged at 3AM by apps built with all three of these. Here's which one made me want to quit programming.

Remix
/compare/remix/sveltekit/ssr-performance-showdown
47%
tool
Recommended

Astro - Static Sites That Don't Suck

integrates with Astro

Astro
/tool/astro/overview
45%
tool
Recommended

Fix Astro Production Deployment Nightmares

integrates with Astro

Astro
/tool/astro/production-deployment-troubleshooting
45%
compare
Recommended

Which Static Site Generator Won't Make You Hate Your Life

Just use fucking Astro. Next.js if you actually need server shit. Gatsby is dead - seriously, stop asking.

Astro
/compare/astro/nextjs/gatsby/static-generation-performance-benchmark
45%
tool
Recommended

Anthropic TypeScript SDK

Official TypeScript client for Claude. Actually works without making you want to throw your laptop out the window.

Anthropic TypeScript SDK
/tool/anthropic-typescript-sdk/overview
38%
alternatives
Recommended

Webpack is Slow as Hell - Here Are the Tools That Actually Work

Tired of waiting 30+ seconds for hot reload? These build tools cut Webpack's bloated compile times down to milliseconds

Webpack
/alternatives/webpack/modern-performance-alternatives
34%

Recommendations combine user behavior, content similarity, research intelligence, and SEO optimization