A few days ago, I installed Angular 20 (global) and tried working on a new project. For the new project i installed the latest LTS node version (22.17.0). Today i went back to an important old one and tried to continue working on it. It is currently written in Angular 18. I tried to build it, but it failed. I tried many things to get it to work again. After one hour I removed npm, nodejs, angular from my computer and I reinstalled Node 20.19.3 (npm 10.8.2) and Angular 18.2.13.
I created a new angular test project to check if it works: no ssr, with scss named test.
It still failed with the same error (when executing ng serve):
An unhandled exception occurred: Cannot find module './compile.js'
Require stack:
- D:\work\test\node_modules\css-select\lib\index.js
- D:\work\test\node_modules\critters\dist\critters.js
- D:\work\test\node_modules\@angular\build\src\utils\index-file\inline-critical-css.js
- D:\work\test\node_modules\@angular\build\src\utils\index-file\index-html-generator.js
- D:\work\test\node_modules\@angular\build\src\tools\esbuild\index-html-generator.js
- D:\work\test\node_modules\@angular\build\src\builders\application\execute-post-bundle.js
- D:\work\test\node_modules\@angular\build\src\builders\application\execute-build.js
- D:\work\test\node_modules\@angular\build\src\builders\application\index.js
- D:\work\test\node_modules\@angular\build\src\private.js
- D:\work\test\node_modules\@angular-devkit\build-angular\src\builders\dev-server\builder.js
- D:\work\test\node_modules\@angular-devkit\build-angular\src\builders\dev-server\index.js
- D:\work\test\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
What can I try now? Thank you in advance!
This line of code resolved the issue for me:
npm i [email protected]
What does it do? It downgrades css-select to an older version, which is responsible for the issue.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With