{"record":{"id":"fd8332b25762e7d4","repo":"shadcn-ui/ui","slug":"could-not-resolve-shadcn-tailwind-css","errorCode":null,"errorMessage":"Could not resolve shadcn/tailwind.css.","messagePattern":"Could not resolve shadcn/tailwind\\.css\\.","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/shadcn/src/commands/eject.ts","lineNumber":215,"sourceCode":"  }\n\n  const cliRoot = process.argv[1]\n    ? path.dirname(path.resolve(process.argv[1]))\n    : cwd\n\n  for (const candidate of [\n    path.join(cliRoot, \"tailwind.css\"),\n    path.join(cliRoot, \"dist\", \"tailwind.css\"),\n    path.join(cliRoot, \"src\", \"tailwind.css\"),\n    path.join(process.cwd(), \"src/tailwind.css\"),\n    path.join(process.cwd(), \"dist/tailwind.css\"),\n  ]) {\n    if (fsExtra.existsSync(candidate)) {\n      return candidate\n    }\n  }\n\n  throw new Error(\"Could not resolve shadcn/tailwind.css.\")\n}\n\nasync function removeShadcnDependency(cwd: string) {\n  const packageManager = await getPackageManager(cwd)\n\n  switch (packageManager) {\n    case \"npm\":\n      await execa(\"npm\", [\"uninstall\", \"shadcn\"], { cwd })\n      break\n    case \"pnpm\":\n      await execa(\"pnpm\", [\"remove\", \"shadcn\"], { cwd })\n      break\n    case \"yarn\":\n      await execa(\"yarn\", [\"remove\", \"shadcn\"], { cwd })\n      break\n    case \"bun\":\n      await execa(\"bun\", [\"remove\", \"shadcn\"], { cwd })\n      break","sourceCodeStart":197,"sourceCodeEnd":233,"githubUrl":"https://github.com/shadcn-ui/ui/blob/efac5987074af84ece57c367c6dd83387b967022/packages/shadcn/src/commands/eject.ts#L197-L233","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Install shadcn locally (npm/pnpm/yarn/bun add shadcn) so node_modules/shadcn/dist/tailwind.css is present.","Run the CLI via `npx shadcn@latest eject` so the asset version matches the code.","If building from source, ensure the build pipeline copies tailwind.css into dist/.","As a fallback the resolver also checks, manually place tailwind.css at <cwd>/src/tailwind.css."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"import fsExtra from \"fs-extra\"\nimport path from \"path\"\n\nfunction hasLocalShadcnTailwindCss(cwd: string): boolean {\n  return fsExtra.existsSync(\n    path.join(cwd, \"node_modules/shadcn/dist/tailwind.css\")\n  )\n}\n\nif (!hasLocalShadcnTailwindCss(process.cwd())) {\n  throw new Error(\"Install shadcn locally before ejecting.\")\n}","typeGuard":"import fsExtra from \"fs-extra\"\nimport path from \"path\"\n\nfunction hasResolvedTailwindCss(cwd: string): boolean {\n  return fsExtra.existsSync(\n    path.join(cwd, \"node_modules/shadcn/dist/tailwind.css\")\n  ) || fsExtra.existsSync(path.join(cwd, \"src/tailwind.css\"))\n}","tryCatchPattern":null,"preventionTips":["Pin a local shadcn install rather than a global one before ejecting.","Run eject with `npx shadcn@latest` so the bundled asset matches the code."],"tags":["eject","asset-resolution","install","tailwind"],"backgroundTag":null,"analyzedSha":"efac5987074af84ece57c367c6dd83387b967022","analyzedAt":"2026-08-12T05:00:50.218Z","schemaVersion":2},"datasetVersion":"2026-08-12T13:17:24.610Z"}