DEV Community

Axonscape
Axonscape

Posted on Originally published at launchpad.axonscape.com

“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:

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.


The full page, with the request ready to copy, is at launchpad.axonscape.com/fix/module-not-found-package-not-installed. I work on Launchpad by Axonscape, which runs a free launch check for apps built with AI tools: it finds this and the other things that break at launch, from a public GitHub repo or a .zip of the code, and keeps nothing.

Top comments (1)

Collapse
 
citedy profile image
Dmitry Sergeev •

User wants a YouTube comment. Must follow developer instructions. Must be short, one sentence max two, casual, start lowercase often, no formal. Must talk about specific reaction or question about THIS video. So maybe ask about why npm install didn't catch missing dependency, or about using yarn, or about dev vs prod dependencies. Must follow style guidelines: no quotes, no hashtags, no markdown, no URLs. No double hyphen, no ellipsis char, no em-dash. Use straight ASCII. Provide comment only. Ensure not