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

前端 未结 11 1979
天命终不由人
天命终不由人 2020-12-09 15:25

I\'m getting this error after upgrading to angular 9. I\'m using visual studio 2019, ASP .NET core with angular. Even if I create new project and update angular to 9 version

11条回答
  •  爱一瞬间的悲伤
    2020-12-09 16:25

    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.

提交回复
热议问题