Site deploy fail

If you look closely the error describes the problem and how to fix it.

1:49:03 AM: npm ERR! ERESOLVE unable to resolve dependency tree

This is a dependency error.

1:49:03 AM: npm ERR! Found: webpack@5.61.0
1:49:03 AM: npm ERR! node_modules/webpack
1:49:03 AM: npm ERR! dev webpack@"^5.40.0" from the root project

Webpack 5 is in use at the root of the project.

1:49:03 AM: npm ERR! Could not resolve dependency:
1:49:03 AM: npm ERR! peer webpack@"^4.0.0" from optimize-css-assets-webpack-plugin@6.0.1

The optimize-css-assets-webpack-plugin wants Webpack 4.

1:49:03 AM: npm ERR! Fix the upstream dependency conflict, or retry
1:49:03 AM: npm ERR! this command with --force, or --legacy-peer-deps
1:49:03 AM: npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

You can try npm install --force or npm install --legacy-peer-deps

Here’s the same answer from Netlify support to the same question:
https://answers.netlify.com/t/build-problems-but-works-on-local-machine/42888

2 Likes