Module not found: Can't resolve 'tailwindcss' after Vercel build

Deployment·Sep 12, 2026·intermediate·
Quick answer

Vercel's production install can prune devDependencies before the build step in some configurations, so if `tailwindcss` (or another build-time tool) is listed only under `devDependencies`, the build can fail even though it works locally. Move build-critical packages to `dependencies`, or confirm your install command isn't skipping dev packages.

What causes this error

Locally, npm install installs both dependencies and devDependencies, so build tools like tailwindcss or postcss are always present. Some production deployment configurations run installs in a way that's stricter about what counts as needed at build time, and a misconfigured install command or environment can leave devDependencies out — breaking the build even though nothing changed in your code.

The Fix

// package.json — move build-time tools out of devDependencies
// if your platform's install step is excluding them
{
  "dependencies": {
    "tailwindcss": "^4.0.0",
    "postcss": "^8.0.0"
    // ...
  }
}

Alternatively, check your platform's project settings for an install command override (e.g. npm install --production) that's explicitly skipping devDependencies — removing that flag is often the real fix instead of moving every package around.

Common causes / variations

  • A custom install command accidentally passing --omit=dev or --production
  • An environment variable like NODE_ENV=production being set before the install step runs, which some package managers interpret as skip-devDependencies
  • Copying deployment config from a different project with different install assumptions

Related errors

See also: Module not found on Vercel (case sensitivity), ENOENT routes-manifest.json.

Was this fix helpful?

Comments

Loading comments...

Fix: Module not found tailwindcss after Vercel build | BugFixer | BugFixer