I've build a app in Angular 2, and have encountered a issue.
I have used angular CLI to create my application, I have created my components and services using Angular CLI and I use "ng serve" to run the application locally and everything works fine. In order to create a build for PROD I'm using the command "ng build --Prod --base-href ./ --aot", it creates a DIST folder and hosting the folder in IIS opens the application fine. When I check in the code to TFS there is a event which automatically creates DIST folder using jenkins and pushes the build to my server. Now if I browse the application for server it throws the following errors "No provider for t!" and Error: DI Error. I don't know what I'm doing wrong here.
Below are the screenshots of the error
Any help is much appreciated.
I was having the same problem. I was able to solve it by:
ng serve -aot
. I was able to find out what the missing class was as this is running AOT without running minify/uglify. In my case, I was having a problem using the Logger class in the angular2-logger/core module. Once I removed the reference from the constructor and reran compilation, it worked like a charm. I then tested with ng serve -prod
to confirm that was also fixed.
One thing I found was that I had to explicitly kill Angular CLI and rebuild. For some reason, when I modified one line and saved, it said it recompiled and was still broken. Only when I killed it and ran the command again did I figure out it was really fixed.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With