npm install fails with ERESOLVE on your Lovable or Bolt export
You exported your app from Lovable, Bolt, or v0 to run it yourself, typed npm install, and instead of installing anything it printed a wall of red ending in ERESOLVE unable to resolve dependency tree or ERESOLVE could not resolve. Your app is not broken. Its dependency list is contradictory, and that is common in AI generated projects.
How common is this?
Very. I ran a clean-room install and build of 16 recently updated, publicly available Lovable-built apps. Four of the 16, one in four, failed at npm install with exactly this ERESOLVE error before a single line of their code ever ran. The owners likely never saw it, because the AI tool's own environment resolved packages differently than a fresh machine does.
What the error actually means
Every package in your package.json declares which versions of its "peer" packages it works with. ERESOLVE means two of your packages disagree: for example, a UI library that demands React 18 while your project has React 19, or a date picker pinned to an old version of a library everything else has moved past. AI code generators cause this often because they pick each package version independently, without checking the combination, and their sandboxes silently paper over the conflict.
Fix 1: the fast unblock (fine for local development)
npm install --legacy-peer-deps
This tells npm to install anyway and ignore the peer conflicts, which is how npm behaved for years before it got strict. It works in the majority of cases because the conflict is usually a package being overly cautious about a version that is actually fine. The risk: if the conflict is real, you find out at runtime instead of install time.
Fix 2: make it stick for your deploys
If fix 1 works locally but your Vercel, Netlify, or Docker build still fails, the build machine is running plain npm install. Create a file named .npmrc in the project root containing:
legacy-peer-deps=true
Commit it. Every environment that installs your project now uses the same relaxed behavior.
Fix 3: the correct fix (resolve the actual conflict)
Read the ERESOLVE output carefully. It names the two packages that disagree, in a block like "Found: react@19.1.0" followed by "Could not resolve dependency: peer react@^18.0.0 from some-library@2.3.0". Then either:
- Upgrade the complaining library to a version that supports your React (check its releases page), or
- Pin the conflicting package to the version the rest of the tree expects, or
- Remove the library if the AI added it and nothing imports it, which happens more often than you would think.
After editing package.json, delete node_modules and package-lock.json and run a fresh npm install to confirm the tree resolves cleanly with no flags.
One safety note for exported AI projects
If you are installing a project you did not write, run npm install --ignore-scripts the first time. Install scripts execute arbitrary code, and you should know what a project contains before you let it run anything.
Still stuck?
Run the instant diagnosis. Paste your public repo URL into the form and an automated clean-room check runs the install and build, then posts a plain English report naming the real conflict, in minutes, free. ERESOLVE failures are precisely what it catches. Private repo or zip? Email works too.
Get an instant free diagnosisOr email me instead. Fixes with 24 hour turnaround start at $95. Prefer self-serve? The $5 instant diagnosis on Apify checks your repo privately, no public issue needed.