Description
Command
build
Is this a regression?
- Yes, this behavior used to work in the previous version
The previous version in which this bug was not present was
Just yesterday — same project and same codebase (Angular 18, 19 and 20 worked)
Description
Yesterday, Angular 18, 19 and 20 projects were building and deploying successfully using ng build. Today, without any changes to the codebase or dependencies, the same ng build command fails in all branches — even ones that previously built successfully.
Error:
An unhandled exception occurred: Cannot find module './compile.js'
Require stack:
- node_modules/css-select/lib/index.js
- node_modules/critters/dist/critters.js
- node_modules/@angular/build/src/utils/index-file/inline-critical-css.js
- ...
Minimal Reproduction
Steps to reproduce:
- Clone a project built with Angular 18 or 19
- Run:
rm -rf node_modules package-lock.json
npm install
ng build - Observe the error
This fails even in previously working branches with no changes.
Exception or Error
Full error here:
macber@192 project % ng build
An unhandled exception occurred: Cannot find module './compile.js'
Require stack:
- /Users/macber/Documents/GitHub/project/project/node_modules/css-select/lib/index.js
- /Users/macber/Documents/GitHub/project/project/node_modules/critters/dist/critters.js
- /Users/macber/Documents/GitHub/project/project/node_modules/@angular/build/src/utils/index-file/inline-critical-css.js
- /Users/macber/Documents/GitHub/project/project/node_modules/@angular/build/src/utils/index-file/index-html-generator.js
- /Users/macber/Documents/GitHub/project/project/node_modules/@angular/build/src/tools/esbuild/index-html-generator.js
- /Users/macber/Documents/GitHub/project/project/node_modules/@angular/build/src/builders/application/execute-post-bundle.js
- /Users/macber/Documents/GitHub/project/project/node_modules/@angular/build/src/builders/application/execute-build.js
- /Users/macber/Documents/GitHub/project/project/node_modules/@angular/build/src/builders/application/index.js
- /Users/macber/Documents/GitHub/project/project/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
See "/private/var/folders/8q/5xj363g57bn5v5rtf_rbhd000000gp/T/ng-1rczGt/angular-errors.log" for further details.
macber@192 project %
Your Environment
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 19.2.15
Node: 22.16.0
Package Manager: npm 10.9.2
OS: darwin x64
Angular: 19.2.14
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, platform-server
... router
Package Version
------------------------------------------------------
@angular-devkit/architect 0.1902.15
@angular-devkit/core 19.2.15
@angular-devkit/schematics 19.2.15
@angular/build 19.2.15
@angular/cdk 19.2.19
@angular/cli 19.2.15
@angular/material 19.2.19
@angular/ssr 19.2.15
@schematics/angular 19.2.15
rxjs 7.8.2
typescript 5.7.3
zone.js 0.15.1
Anything else relevant?
This seems to be related to the critters package and its dependency on css-select, which may be missing or corrupted. The issue occurs regardless of whether Angular 18, 19 or 20 is used — even previously stable builds are affected. I suspect a recent npm release or an update to css-select may have introduced this.
I’m using macOS and have tried with Node v18.x and v20.x with no luck.