Error fixes / Vercel
Vercel
Vercel build failed: module not found
The production build imported a package that is not installed, or a file that is not on disk.
The error
Module not found: Can't resolve 'some-package'
What it means
Next.js prints Module not found: Can't resolve when an import does not match an installed dependency or a real file. On Vercel this often means the package is in the chat transcript but not in package.json, the import path case does not match the file, or a dev-only file was imported from runtime code. next dev on your laptop can mask this if a global install or an old node_modules folder still has the package.
Fix
- Read the full import path in the build log. That is the missing module, not the last line of the trace.
- If it is a package name, add it with the package manager the repo uses, and commit the lockfile.
- If it is a relative path, fix the filename. Linux builds are case-sensitive. Button.tsx and button.tsx are different.
- Delete node_modules and run a clean install locally, then run the production build. Do not rely on next dev.
- Push the lockfile. Vercel installs from it. A dependency that exists only on your machine will fail there.
Prompt
Fix prompt
The Vercel build fails with Module not found: Can't resolve followed by a module name. Open that import. If the package is missing, add it to package.json with the repo's package manager and update the lockfile. If the path is a local file, correct the path and the letter case. Do not add unrelated packages. Run the production build locally and stop when it passes. Tell me the import you fixed.
Questions
It imports fine on my machine. Why does Vercel fail?
Your local node_modules can contain packages that are not in package.json. Vercel installs from the lockfile on a case-sensitive filesystem. A clean install plus the production build reproduces the failure.
Should I set SKIP_ENV or ignore TypeScript to get past it?
No. A missing module is a real break. Ignoring the type check will not create the file the import needs.
The error names a file I deleted. What should I do?
An import still points at it. Search the repo for that path and either restore the file or update the import. Then rebuild.