angular-cli: TimeoutException: The Angular CLI process did not start listening for requests within the timeout period of 0 seconds

I’m getting TimeoutException after upgrading to angular 9. I’m using visual studio, ASP .NET core with angular. Even if i create new project and update angular to 9 version, It stops working Complete list of page response :

TimeoutException: The Angular CLI process did not start listening for requests within the timeout period of 0 seconds. Check the log output for error information.
Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout<T>(Task<T> task, TimeSpan timeoutDelay, string message)
Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task<Uri> baseUriTask, CancellationToken applicationStoppingToken, bool proxy404s)
Microsoft.AspNetCore.Builder.SpaProxyingExtensions+<>c__DisplayClass2_0+<<UseProxyToSpaDevelopmentServer>b__0>d.MoveNext()
Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)

My package.json file is :

{
  "name": "webapplication10",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "build:ssr": "ng run WebApplication10:server:dev",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "9.0.0",
    "@angular/cdk": "~9.0.0",
    "@angular/common": "9.0.0",
    "@angular/compiler": "9.0.0",
    "@angular/core": "9.0.0",
    "@angular/forms": "9.0.0",
    "@angular/material": "~9.0.0",
    "@angular/platform-browser": "9.0.0",
    "@angular/platform-browser-dynamic": "9.0.0",
    "@angular/platform-server": "9.0.0",
    "@angular/router": "9.0.0",
    "@nguniversal/module-map-ngfactory-loader": "8.1.1",
    "aspnet-prerendering": "^3.0.1",
    "bootstrap": "^4.4.1",
    "core-js": "^3.6.4",
    "jquery": "3.4.1",
    "oidc-client": "^1.10.1",
    "popper.js": "^1.16.1",
    "rxjs": "^6.5.4",
    "tslib": "^1.10.0",
    "zone.js": "~0.10.2"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^0.900.1",
    "@angular/cli": "9.0.1",
    "@angular/compiler-cli": "9.0.0",
    "@angular/language-service": "9.0.0",
    "@types/jasmine": "^3.5.3",
    "@types/jasminewd2": "~2.0.8",
    "@types/node": "^12.12.27",
    "codelyzer": "^5.2.1",
    "jasmine-core": "~3.5.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "^4.4.1",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "^2.1.1",
    "karma-jasmine": "~3.1.1",
    "karma-jasmine-html-reporter": "^1.5.2",
    "typescript": "3.7.5"
  },
  "optionalDependencies": {
    "node-sass": "^4.12.0",
    "protractor": "~5.4.2",
    "ts-node": "~8.4.1",
    "tslint": "~5.20.0"
  }
}

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 25
  • Comments: 24

Most upvoted comments

https://jasontaylor.dev/asp-net-core-angular-9-upgrade/

in ClientApp/package.json

change “start”: “ng serve” to “start”: “echo Starting… && ng serve”

In package.json I change ng serve to ng serve --host 0.0.0.0 and now it works…

Reproduction I simply create a new project in visual studio 2019, select Asp.net and angular. projects works fine. then I update angular 8 to angular 9 by using ng update @angular/core @angular/cli it updates and when I run project It gives me that error

Other technical details Microsoft Visual Studio Community 2019 Version 16.4.5 Microsoft .NET Framework Version 4.8.03752 ASP.NET and Web Tools 2019 16.4.460.23317 I solved this issue by So I asked stackoverflow community (https://stackoverflow.com/q/60189930/7979535) and found that this issue is known https://github.com/dotnet/aspnetcore/issues/17277#issue-526272056

In package.json I change ng serve to ng serve --host 0.0.0.0 and now it works…

Can I buy you a beer? Be your servant? Make you breakfast everyday. Holy shit I spent so long on this problem and you solved it

Here is a workaround:

In package.json change the start-script from “ng serve” to “ngserve”

"scripts": {
  "start": "ngserve",

In the same directory create a file ngserve.cmd with the following content:

@echo ** Angular Live Development Server is listening on localhost:%~2, open your browser on http://localhost:%~2/ **
ng serve %1 %~2

Now Dotnet gets the line it is waiting for. After that the command ng serve will start the server (so in fact the Angular Live Development Server is not yet listening), the browser will open, and first it won’t work (ng serve still compiling), but if you press reload after a while, it should be fine.

This is just a workaround, but it works for us.

@dc-m my logging is currently set as such:

  "Logging": {
    "LogLevel": {
      "Default": "Information",
      "Microsoft": "Warning",
      "Microsoft.Hosting.Lifetime": "Information"
    }
  },

To recreate this problem, open Visual Studio 2019, then create an ASP.NET Core Angular web app. It will create with Angular 8 in package.json. Now run NG Update and note the fun about to begin.

Just when you think you have it all ready to go, start the project using IIS express (the default server for VS2019). After the failure run ng --versio .



Angular CLI: 9.0.5
Node: 12.14.1
OS: win32 x64

Angular: 9.0.5
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Ivy Workspace: Yes

Package                                    Version
--------------------------------------------------------------------
@angular-devkit/architect                  0.900.5
@angular-devkit/build-angular              0.900.5
@angular-devkit/build-optimizer            0.900.5
@angular-devkit/build-webpack              0.900.5
@angular-devkit/core                       9.0.5
@angular-devkit/schematics                 9.0.5
@ngtools/webpack                           9.0.5
@nguniversal/module-map-ngfactory-loader   8.2.6
@schematics/angular                        9.0.5
@schematics/update                         0.900.5
rxjs                                       6.5.4
typescript                                 3.7.5
webpack                                    4.41.2

I also had to upgrade Typescript to 3.7.5 per the compile warning. I think NG Update should do that automatically.

Because this problem frequently occurs due to the initial build time of ng serve exceeding the programmed timeout window of the .NET SPA service, so by giving it the echo, the .NET SPA service receives some data and believes it’s connected.

I’m sorry, but this issue is not caused by Angular CLI.

This is being tracked in https://github.com/dotnet/aspnetcore/issues/17277

The bttb workaround is the fix that finally worked for me. I have been following this issue for months and have tried all the previous suggestions but none of them worked for me. Thank you bttb. The only way I could get the angular page to start was to make a dummy change to the angular code and then save the change, which was irritating and a real waste of time.