Webpack build exits with code 1 ("ERROR in") in CI
Webpack finished compiling but emitted at least one "ERROR in" entry, so it exits with code 1. The job fails on that exit code; the actual cause is each "ERROR in" block, not the exit number.
What this error means
The log shows one or more "ERROR in ./path" blocks, then "webpack ... compiled with N errors" and "Process completed with exit code 1".
webpack
ERROR in ./src/index.js 10:0-30
Module not found: Error: Can't resolve './missing' in '/app/src'
webpack 5.91.0 compiled with 1 error in 4213 ms
Error: Process completed with exit code 1.Common causes
A real compile error in the bundle
An unresolved import, a failed loader, or a syntax error produced an "ERROR in" entry, which makes Webpack exit non-zero.
Warnings escalated to errors
A config or CI flag treats warnings as errors, so an otherwise non-fatal issue fails the build.
How to fix it
Read the first "ERROR in" block
- Scroll to the first "ERROR in" entry; later ones are often cascades.
- Fix the named module, import, or loader problem.
- Re-run until Webpack reports "compiled successfully".
Check whether warnings are failing the build
If the errors are really warnings, decide whether to fix them or stop escalating warnings to errors in CI.
Terminal
# example: a CI flag turning warnings into failures
CI=true npm run buildHow to prevent it
- Fix build errors locally before pushing; they reproduce in CI.
- Be deliberate about treating warnings as errors.
- Read the first error, not the exit code, to diagnose.
Related guides
Webpack "You may need an appropriate loader to handle this file type" in CIFix Webpack "Module parse failed: ... You may need an appropriate loader to handle this file type" in CI - no…
Webpack "configuration has an unknown property" schema error in CIFix Webpack "Invalid configuration object ... has an unknown property" in CI - the config uses an option Webp…
Webpack "ERESOLVE could not resolve" peer dependency at install before build in CIFix npm "ERESOLVE could not resolve" on a Webpack peer dependency in CI - the loader/plugin peer range does n…