shadcn-ui/ui · error

Could not resolve shadcn/tailwind.css.

Error message

Could not resolve shadcn/tailwind.css.

What it means

resolveShadcnTailwindCss exhausts every candidate location for the bundled tailwind.css — project node_modules/shadcn/dist/tailwind.css, the CLI root and its dist/src siblings, and cwd src/dist — and throws when none exist. The eject command copies this base Tailwind stylesheet into your project.

Source

Thrown at packages/shadcn/src/commands/eject.ts:215

  }

  const cliRoot = process.argv[1]
    ? path.dirname(path.resolve(process.argv[1]))
    : cwd

  for (const candidate of [
    path.join(cliRoot, "tailwind.css"),
    path.join(cliRoot, "dist", "tailwind.css"),
    path.join(cliRoot, "src", "tailwind.css"),
    path.join(process.cwd(), "src/tailwind.css"),
    path.join(process.cwd(), "dist/tailwind.css"),
  ]) {
    if (fsExtra.existsSync(candidate)) {
      return candidate
    }
  }

  throw new Error("Could not resolve shadcn/tailwind.css.")
}

async function removeShadcnDependency(cwd: string) {
  const packageManager = await getPackageManager(cwd)

  switch (packageManager) {
    case "npm":
      await execa("npm", ["uninstall", "shadcn"], { cwd })
      break
    case "pnpm":
      await execa("pnpm", ["remove", "shadcn"], { cwd })
      break
    case "yarn":
      await execa("yarn", ["remove", "shadcn"], { cwd })
      break
    case "bun":
      await execa("bun", ["remove", "shadcn"], { cwd })
      break

View on GitHub (pinned to efac598707)

Solutions

  1. Install shadcn locally (npm/pnpm/yarn/bun add shadcn) so node_modules/shadcn/dist/tailwind.css is present.
  2. Run the CLI via `npx shadcn@latest eject` so the asset version matches the code.
  3. If building from source, ensure the build pipeline copies tailwind.css into dist/.
  4. As a fallback the resolver also checks, manually place tailwind.css at <cwd>/src/tailwind.css.
Defensive patterns

Strategy: validation

Validate before calling

import fsExtra from "fs-extra"
import path from "path"

function hasLocalShadcnTailwindCss(cwd: string): boolean {
  return fsExtra.existsSync(
    path.join(cwd, "node_modules/shadcn/dist/tailwind.css")
  )
}

if (!hasLocalShadcnTailwindCss(process.cwd())) {
  throw new Error("Install shadcn locally before ejecting.")
}

Type guard

import fsExtra from "fs-extra"
import path from "path"

function hasResolvedTailwindCss(cwd: string): boolean {
  return fsExtra.existsSync(
    path.join(cwd, "node_modules/shadcn/dist/tailwind.css")
  ) || fsExtra.existsSync(path.join(cwd, "src/tailwind.css"))
}

Prevention

When it happens

Trigger: Running `shadcn eject` when the locally-installed shadcn package is missing dist/tailwind.css (dev/partial install), the CLI was invoked globally without the asset bundled, or process.argv[1] doesn't resolve to a directory containing the asset.

Common situations: Global npm install of shadcn without bundled assets, monorepo hoisting where node_modules/shadcn/dist is absent, building shadcn from source without the CSS copy step, running a pinned/prerelease version that omitted the asset.

Related errors


AI-assisted analysis of shadcn-ui/ui@efac598707 (2026-08-12). Data as JSON: /api/errors/fd8332b25762e7d4. Report an issue: GitHub.