简体   繁体   中英

Error from `ng serve` after running `ng update @angular/cli @angular/core` and unable to serve Angular project

In my Angular project, I was having errors while trying to build a docker image. I used ng update @angular/cli @angular/core and was able to resolve that error, and now I'm able to create a docker container of my project that is served. However, now I cannot serve my project with ng serve because I get the following error:

An unhandled exception occurred: compiler.getInfrastructureLogger is not a function

getInfrastructureLogger is NOT a function I created, I'm assuming it's coming from a node mod. I've tried deleting the node_mod folder and install them again with npm install , but I still get the same error. I've tried cleaning my npm cache and I still get the error.

I went back a couple of commits (to before I ran ng update @angular/cli @angular/core ) and then I'm able to run ng serve with no errors, but am then unable to create my docker images. I need to be able to use containers, so I have to use ng update @angular/cli @angular/core . But I also want to be able to serve my project as a standalone (plus it better for developing).

Does anyone have any advise on this error? Where it's coming from? Solutions? I would really appreciate it. Thanks for any help you can give.

***To specify, I used ng update @angular/cli @angular/core --force it was the only for me to run that command.

My project is Angular 8, node node version 12.14.

The update in angular versions or one of the dependencies caused this error. We could help more if we knew what version of Angular you were coming from and what version you were updating to.

First, if you're upgrading to the latest stable Angular version (8.x), make sure you have node 10.9 or later installed.

Regardless, the Angular Upgrade Guide is an awesome tool that allows you to input the version you're coming from and the version you're going to and it will give you step-by-step instructions as to what you need to do in order to upgrade your angular app. Try upgrading one major version at a time following these instructions. It almost always resolves my problems.

Please note: It's better to upgrade one version at a time

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM