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
None of the solutions here worked for me. The problem began after I upgrade components of my solution to their last versions. The only thing that works for me is to upgrade my global angular cli to have same version as my local one :
npm uninstall -g angular-cli
npm cache clean
npm cache verify
npm install -g @angular/cli@latest
I added verbosity to the serving process in the file package.json
like this.
"scripts": {
"ng": "ng",
"start": "ng serve --verbose",
"build": "ng build", ...
}, ...
No idea why it worked but I sense it somehow relates to causing the same slowdown as echo does.
If you are doing backend work only, in your startup.cs comment out
spa.UseAngularCliServer(npmScript: "start");
and add
spa.UseProxyToSpaDevelopmentServer("http://localhost:4200");
Like so...
//spa.UseAngularCliServer(npmScript: "start");
spa.UseProxyToSpaDevelopmentServer("http://localhost:4200");//Todo Switch back for SPA Dev
Run the SPA from cmd (in ClientApp Directory) via npm start.
Then when your run or debug your full app from Visual Studio, it will spin up so much faster.
As suggested in https://developercommunity.visualstudio.com/solutions/446713/view.html, you should setup the StartupTimeout configuration setting.
Basically in Startup.cs:
app.UseSpa(spa =>
{
spa.Options.SourcePath = "./";
//Configure the timeout to 5 minutes to avoid "The Angular CLI process did not start listening for requests within the timeout period of 50 seconds." issue
spa.Options.StartupTimeout = new TimeSpan(0, 5, 0);
if (env.IsDevelopment())
{
spa.UseAngularCliServer(npmScript: "start");
}
});
to resolve the strict mode error remove this line from main.ts
export { renderModule, renderModuleFactory } from '@angular/platform-server';
This doesn't resolve the timeout issue however. I am also getting this error after upgrading to Angular 9 and using .NET core.
Running the angular app using "ng serve" and then changing your startup spa script to use UseProxyToSpaDevelopmentServer works as a work-around
In my case there were TypeScript compile errors that were not caught by SpaServices or ts-node. There were references using the same file name with different namespaces that confused the runtime compiler. Execute ng build in the ClientApp folder and make sure there are no errors.