Skip to content

ASP.Net Core 8 / Angular 18 won't start after upgrading Angular from 17 to 18 #28331

@awdorrin

Description

@awdorrin

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

Don't known / other

Is this a regression?

Yes

Description

Upgraded Angular/material from 17 to 18 with the standard ng update commands provided via https://angular.dev/update-guide?v=17.0-18.0&l=1
Attempting to start in Visual Studio get exceptions shown below

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

All of these lines were prefixed with: "Microsoft.AspNetCore.SpaServices: Error:" I removed that text for clarity.

 node:internal/errors:496
     ErrorCaptureStackTrace(err);
     ^
 Error: Cannot set headers after they are sent to the client
     at new NodeError (node:internal/errors:405:5)
     at ServerResponse.setHeader (node:_http_outgoing:648:11)
     at setResponseHeader (C:\work\_git\myapp\MyApp\ClientApp\node_modules\webpack-dev-middleware\dist\utils\compatibleAPI.js:120:14)
     at processRequest (C:\work\_git\myapp\MyApp\ClientApp\node_modules\webpack-dev-middleware\dist\middleware.js:599:7)
     at ready (C:\work\_git\myapp\MyApp\ClientApp\node_modules\webpack-dev-middleware\dist\utils\ready.js:16:5)
     at middleware (C:\work\_git\myapp\MyApp\ClientApp\node_modules\webpack-dev-middleware\dist\middleware.js:640:5)
     at Layer.handle [as handle_request] (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\layer.js:95:5)
     at trim_prefix (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:328:13)
     at C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:286:9
     at Function.process_params (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:346:12)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:280:10)
     at C:\work\_git\myapp\MyApp\ClientApp\node_modules\connect-history-api-fallback\lib\index.js:26:14
     at Layer.handle [as handle_request] (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\layer.js:95:5)
     at trim_prefix (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:328:13)
     at C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:286:9
     at Function.process_params (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:346:12)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:280:10)
     at goNext (C:\work\_git\myapp\MyApp\ClientApp\node_modules\webpack-dev-middleware\dist\middleware.js:133:16)
     at processRequest (C:\work\_git\myapp\MyApp\ClientApp\node_modules\webpack-dev-middleware\dist\middleware.js:605:15)
     at ready (C:\work\_git\myapp\MyApp\ClientApp\node_modules\webpack-dev-middleware\dist\utils\ready.js:16:5)
     at middleware (C:\work\_git\myapp\MyApp\ClientApp\node_modules\webpack-dev-middleware\dist\middleware.js:640:5)
     at Layer.handle [as handle_request] (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\layer.js:95:5)
     at trim_prefix (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:328:13)
     at C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:286:9
     at Function.process_params (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:346:12)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:280:10)
     at Server.setHeaders (C:\work\_git\myapp\MyApp\ClientApp\node_modules\webpack-dev-server\lib\Server.js:2829:5)
     at Layer.handle [as handle_request] (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\layer.js:95:5)
     at trim_prefix (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:328:13)
     at C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:286:9
     at param (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:365:14)
     at param (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:376:14)
     at Function.process_params (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:421:3)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\index.js:280:10)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:141:14)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7)
     at next (C:\work\_git\myapp\MyApp\ClientApp\node_modules\express\lib\router\route.js:145:7) {
   code: 'ERR_HTTP_HEADERS_SENT'
 }
 Node.js v18.20.3

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

Angular CLI: 18.2.1
Node: 18.20.3
Package Manager: npm 10.7.0
OS: win32 x64

Angular: 18.2.2
... animations, cdk, common, compiler, compiler-cli, core, forms
... language-service, material, platform-browser
... platform-browser-dynamic, platform-server, 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
@angular/cli                    18.2.1
@schematics/angular             18.2.1
rxjs                            7.8.1
typescript                      5.4.5
zone.js                         0.14.10

Anything else?

Angular 17 worked, ran the following commands:

  • ng update @angular/core@18 @angular/cli@18
  • ng update @angular/material@18
  • ng build

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions