npm ERR! 404 Not Found / Module not found: Can't resolve

  • npm
  • Build

What it means

The package your code asks for is not installed, or does not exist at all. AI tools sometimes invent plausible package names, and attackers register those names with malicious code.

Why it happens

  • The AI suggested a package that does not exist.
  • The package exists under a slightly different name.
  • It is used in code but missing from package.json.

How to fix it

  1. Look the package up on npmjs.com: check its downloads, age, repository and maintainer.
  2. Prefer well-known packages, or write the small function yourself.
  3. Never install a near-miss name that appeared recently: it may be a trap.

Let your AI find the cause

Paste this into Claude Code, Cursor, Lovable or whichever AI built your app. It looks first and changes nothing until you have read the answer.

My build fails with 'npm ERR! 404 Not Found' or 'Module not found'. Without installing anything, list each missing package, whether it really exists on npm, what it is meant to do, and a well-known alternative if it does not exist.