[英]Build issue after updating from Angular 7 to Angular 8
I recently updated a project from Angular 7 to Angular 8. When I go to build to prod I'm now getting the following error.我最近将一个项目从 Angular 7 更新到了 Angular 8。当我开始构建到 prod 时,我现在收到以下错误。
ERROR in app/app.component.ts:7:36 - error TS2307: Cannot find module '@angular/router/src/router_module'. app/app.component.ts 中的错误:7:36 - 错误 TS2307:找不到模块“@angular/router/src/router_module”。 7 import { routerNgProbeToken } from "@angular/router/src/router_module"; 7 从“@angular/router/src/router_module”导入 { routerNgProbeToken };
I've gone into the app.component.ts file to take a look at what the problem is, and it says (similar to the build error) cannot find @angular/router/src/router_module
.我已经进入 app.component.ts 文件查看问题是什么,它说(类似于构建错误)找不到@angular/router/src/router_module
。 I haven't touched this project for over a year and I'm struggling to resolve this one (also I'm not that experienced with Angular so that doesn't help either)我已经一年多没有接触过这个项目了,我正在努力解决这个问题(我对 Angular 也没有那么熟悉,所以这也无济于事)
Any suggestions on how I might resolve this so that I can build again would be greatly apprecited.任何关于我如何解决这个问题以便我可以再次构建的建议将不胜感激。
Try this as your import
:试试这个作为你的import
:
import { RouterModule } from '@angular/router';从 '@angular/router' 导入 { RouterModule };
Remove /src/router_module
on the end of the path.删除路径末尾的/src/router_module
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.