← All errors · Next.jsVercel build & deploy errors
Module not found: Can't resolve '...'
Exact error
Module not found: Can't resolve 'some-package'
What it means
The bundler could not locate an imported file or package.
Likely causes
- The package isn't installed (or is only installed locally, not in package.json).
- Wrong relative path or wrong letter case (works on macOS/Windows, fails on Linux/Vercel).
- A path alias like @/ not configured in tsconfig/jsconfig.
- A Node-only module (fs, path) imported into client code.
How to fix it
Install the package and make sure it is saved to package.json:
npm install some-packageCheck the exact file name casing matches the import. Linux filesystems are case-sensitive. To fix a case-only rename in git:
git mv components/button.tsx components/Button.tsxIf you use the @/ alias, confirm it exists:
// tsconfig.json { "compilerOptions": { "baseUrl": ".", "paths": { "@/*": ["./*"] } } }Only import fs/path in server code (Server Components, route handlers, getStaticProps).
Prevent this next time
- Add a CI job that runs `npm ci && npm run build` on every push, mirroring a clean Vercel build.
- Pin your Node.js version in package.json `engines` and commit your lockfile.
Guide: catch outages before your users do.
FAQ
What does "Module not found: Can't resolve '...'" mean?
The bundler could not locate an imported file or package.
What usually causes it?
The package isn't installed (or is only installed locally, not in package.json). Wrong relative path or wrong letter case (works on macOS/Windows, fails on Linux/Vercel). A path alias like @/ not configured in tsconfig/jsconfig. A Node-only module (fs, path) imported into client code.
How do I fix it?
1. Install the package and make sure it is saved to package.json: 2. Check the exact file name casing matches the import. Linux filesystems are case-sensitive. To fix a case-only rename in git: 3. If you use the @/ alias, confirm it exists: 4. Only import fs/path in server code (Server Components, route handlers, getStaticProps).
Related errors
Get new fixes weekly
No spam. Unsubscribe anytime. Privacy