IT Error Decoder

How to Fix Vercel build fails with 'Module not found'

Error message

Module not found: Can't resolve '<package>'.

If you're seeing "Vercel build fails with 'Module not found'", you're not alone. Here's what it means, why it happens, and the steps to resolve it.

What this error means

The Vercel build environment couldn't find a package or file your code imports.

Why this happens

Common causes: the package isn't in `package.json`, it's in `devDependencies` but needed at build time, the import path has wrong casing (case-sensitive on Linux), or a file is git-ignored.

Step-by-step fix

  1. Reproduce locally with a clean install.

    command
    rm -rf node_modules && npm ci && npm run build
  2. Add the missing package as a runtime dependency.

    command
    npm install <package>
  3. Check that the import path's casing exactly matches the file on disk (Linux is case-sensitive, macOS often isn't).

  4. Confirm the file isn't excluded by `.gitignore` or `.vercelignore`.

Affected products

Vercel

Still broken? Try these

  • Open the failing build log on Vercel and find the line printing the resolver error — it usually shows the searched paths.
  • If the package is in `devDependencies`, move it to `dependencies` for production builds.
  • Pin Node.js version in `package.json` engines to match what works locally.

Related errors

Frequently asked questions

What does "Vercel build fails with 'Module not found'" mean?

The Vercel build environment couldn't find a package or file your code imports.

What causes "Vercel build fails with 'Module not found'"?

Common causes: the package isn't in `package.json`, it's in `devDependencies` but needed at build time, the import path has wrong casing (case-sensitive on Linux), or a file is git-ignored.

How do I fix "Vercel build fails with 'Module not found'"?

1. Reproduce locally with a clean install. 2. Add the missing package as a runtime dependency. 3. Check that the import path's casing exactly matches the file on disk (Linux is case-sensitive, macOS often isn't). 4. Confirm the file isn't excluded by `.gitignore` or `.vercelignore`. Always test changes in a non-production environment first.

Browse more errors in Vercel: Fix Vercel deployment errors. Build failures, missing output directories, exceeded build duration, missing env vars, and module resolution issues. Or paste your own error into the error decoder tool to find a match. You can also go back to the homepage to browse common errors by topic.