Bilo Guides FAQ

"Build failed: Module not found: Can't resolve": why it happens and the fix

The build tried to open a file or package you import, and could not find it. The name after "Can't resolve" is exactly what it looked for.

The error looks like this:

Module not found: Can't resolve

How to fix it

  1. Read the name it could not find. It is either a package (like swr) or a path to your own file (like ../components/Mycomponent).
  2. Package? Install it. The Next.js docs say a package you import must be installed, for example npm install swr. Then commit the changed package.json and lock file so the host installs it too.
  3. Your own file? Check the path. Make sure the folder and file name in the import match the real file.
  4. Check capital letters. The Next.js docs point out that wrong casing fails on case-sensitive systems, like most Linux build servers, even if it works on your Windows or Mac computer. Mycomponent and MyComponent are different files there.
  5. Browser code can't use Node-only packages. Packages that need Node.js features (for example a database client) can't be imported into code that runs in the browser. Move that part to server-side code.

What you should see

The build finishes on the host, and the deploy goes live.

Not fixed? Bring the exact message to Bilo and we will look at it with you.

Still stuck? Paste your error into Bilo

Quick questions

It builds locally but not on the host. Why?

Most often a package was installed on your computer but not saved to package.json, or a file name differs only by capital letters.

Does this only apply to Next.js?

The message is also shown by other tools, and the same three checks (installed, path, casing) apply. The linked page is the Next.js explanation.

Which file should I commit?

package.json and your lock file (for example package-lock.json), so the host installs the same packages.

Sources and date checked

Written in our own words from the official pages above. Tool names are only references; we are not affiliated with them. Commands change between versions, so check the linked docs if something differs.

Tell us your idea and get a blueprint with an estimated cost, free.

Start the free interview

Bilo works by connecting to your own AI (Claude, ChatGPT, …). You need an account with that AI, and the usage for writing things comes out of your own AI plan.