Skip to content

ng test command broken when using Node.js 22 on version 18.2.0 #28280

@MikaStark

Description

@MikaStark

Which @angular/* package(s) are the source of the bug?

Don't known / other

Is this a regression?

Yes

Description

When using Node.js 22 (e.g. 22.7.0) with angular 18.2.0, ng command fails because it cannot find some modules.

You can easily reproduce this behavior by starting a whole new project (ng new) and run ng test just after.

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

$ ng test
⠋ Generating browser application bundles (phase: setup)...An unhandled exception occurred: Cannot find module 'source-map-loader'
Require stack:
- /home/mickael-olaria/Développement/ng-hello-world/node_modules/@angular-devkit/build-angular/src/tools/webpack/configs/common.js
- /home/mickael-olaria/Développement/ng-hello-world/node_modules/@angular-devkit/build-angular/src/tools/webpack/configs/index.js
- /home/mickael-olaria/Développement/ng-hello-world/node_modules/@angular-devkit/build-angular/src/builders/karma/index.js
- /home/mickael-olaria/Développement/ng-hello-world/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
See "/tmp/ng-iPSLTf/angular-errors.log" for further details.
⠋ Generating browser application bundles (phase: setup)...^

Please provide the environment you discovered this bug in (run ng version)

Node: 22.7.0
Package Manager: npm 10.8.2
OS: linux x64

Angular: 18.2.1
... animations, cli, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1802.1
@angular-devkit/build-angular   18.2.1
@angular-devkit/core            18.2.1
@angular-devkit/schematics      18.2.1
@schematics/angular             18.2.1
rxjs                            7.8.1
typescript                      5.5.4
zone.js                         0.14.10

Anything else?

Worked as expeected with Angular version 18.1.4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions