我读的书籍从一开始就有第9版 (ASP.NET Core 3 and Angular 9 - Third Edition),并且也使用了Angular模板。我已经安装了最新的Visual Studio更新程序,适用于VS 2019.
Angular项目的模板版本为8,而我读的书是第9版。因此,我尝试升级我的Angular版本。执行
我尝试运行应用程序,但我得到的是HTML。
Angular项目的模板版本为8,而我读的书是第9版。因此,我尝试升级我的Angular版本。执行
ng update
命令后得到以下结果:@angular/cli 8.3.14 -> 9.0.3 ng update @angular/cli
@angular/core 8.2.12 -> 9.0.3 ng update @angular/core
@nguniversal/aspnetcore-engine 8.1.1 -> 8.2.6 ng update @nguniversal/aspnetcore-engine
我更新了cli和core。但是当我尝试更新第三个包时,出现以下错误:
C:\Users\user\Test\ClientApp>ng update @nguniversal/aspnetcore-engine
Using package manager: 'npm'
Collecting installed dependencies...
Found 39 dependencies.
Package '@nguniversal/aspnetcore-engine' is not a dependency.
我尝试运行应用程序,但我得到的是HTML。
Cannot GET /
或者是一个带有异常信息的页面:
System.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.
at Microsoft.AspNetCore.SpaServices.Extensions.Util.TaskTimeoutExtensions.WithTimeout[T](Task`1 task, TimeSpan timeoutDelay, String message)
at Microsoft.AspNetCore.SpaServices.Extensions.Proxy.SpaProxy.PerformProxyRequest(HttpContext context, HttpClient httpClient, Task`1 baseUriTask, CancellationToken applicationStoppingToken, Boolean proxy404s)
at Microsoft.AspNetCore.Builder.SpaProxyingExtensions.<>c__DisplayClass2_0.<<UseProxyToSpaDevelopmentServer>b__0>d.MoveNext()
--- End of stack trace from previous location where exception was thrown ---
at Microsoft.AspNetCore.Diagnostics.DeveloperExceptionPageMiddleware.Invoke(HttpContext context)