Fixes · Deploys that break

“Module not found” on deploy: a package isn't installed

The deploy fails because the code uses a package that isn't in package.json. It worked on your computer because the package happened to be installed there.

What you see

The build fails with Cannot find module 'something' or Could not resolve "some-package", for a package the code imports by name.

Why it happens

The package is installed on your computer (by hand, or by another project) but isn't listed in package.json, so the build server, which installs only what package.json lists, never gets it.

How to fix it

  1. Run npm install <package> in the project, so it's added to package.json.
  2. Commit package.json and the lockfile together, then push.

Or ask your AI tool to fix it

Paste this into Lovable, Bolt, v0, Replit or Cursor, and let it make the change.

My app fails to build when deployed because a package it imports isn't installed. Add every package the code imports to package.json (and the lockfile), with the versions the code expects.

Don't change what the app does.
Never put a secret key or password in the code: read it from an environment variable.
If a step has to be done outside the code, like revoking a key in a provider's dashboard, list it for me at the end instead of skipping it.

How Launchpad helps

When a deploy fails this way, the console names the package and gives this request ready to paste. A committed lockfile, which the launch check looks for, keeps production on the versions you tested.

Check your app for this, freeJoin the waitlist

Related