问题
when i did --> 'ng build --prod' i got this error
ERROR in : Cannot determine the module for class AppComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/app.component.ts! Add AppComponent to the NgModule to fix it.
Cannot determine the module for class OfferCreationFinalForwarderComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/offer-creation-final- forwarder/offer-creation-final-forwarder.component.ts! Add OfferCreationFinalForwarderComponent to the NgModule to fix it. Cannot determine the module for class OfferCommonTopComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/offer-common-top/offer-common-top.component.ts! Add OfferCommonTopComponent to the NgModule to fix it. Cannot determine the module for class OfferCommonRightComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/offer-common-right/offer-common-right.component.ts! Add OfferCommonRightComponent to the NgModule to fix it. Cannot determine the module for class TopMenuComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/top-menu/top-menu.component.ts! Add TopMenuComponent to the NgModule to fix it. Cannot determine the module for class BookingCreationComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/booking-creation/booking-creation.component.ts! Add BookingCreationComponent to the NgModule to fix it. Cannot determine the module for class ShipperCommonRightMenuComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/shipper-common-right-menu/shipper-common-right-menu.component.ts! Add ShipperCommonRightMenuComponent to the NgModule to fix it. Cannot determine the module for class BookingShipperCommonTopComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/booking-shipper-common-top/booking-shipper-common-top.component.ts! Add BookingShipperCommonTopComponent to the NgModule to fix it. Cannot determine the module for class JobboardComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/jobboard/jobboard.component.ts! Add JobboardComponent to the NgModule to fix it. Cannot determine the module for class LogInComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/log-in/log-in.component.ts! Add LogInComponent to the NgModule to fix it. Cannot determine the module for class RegistrationComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/registration/registration.component.ts! Add RegistrationComponent to the NgModule to fix it. Cannot determine the module for class TopMenuRegistrationComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/top-menu-registration/top-menu-registration.component.ts! Add TopMenuRegistrationComponent to the NgModule to fix it. Cannot determine the module for class HomeComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/home/home.component.ts! Add HomeComponent to the NgModule to fix it. Cannot determine the module for class DocumentsComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/documents/documents.component.ts! Add DocumentsComponent to the NgModule to fix it. Cannot determine the module for class MarketPlaceComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/market-place/market-place.component.ts! Add MarketPlaceComponent to the NgModule to fix it. Cannot determine the module for class ShipperLetterInstructionComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/shipper-letter-instruction/shipper-letter-instruction.component.ts! Add ShipperLetterInstructionComponent to the NgModule to fix it. Cannot determine the module for class AcceptanceComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/acceptance/acceptance.component.ts! Add AcceptanceComponent to the NgModule to fix it. Cannot determine the module for class FinalChargesComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/final-charges/final-charges.component.ts! Add FinalChargesComponent to the NgModule to fix it. Cannot determine the module for class BookingsForwarderComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/bookings-forwarder/bookings-forwarder.component.ts! Add BookingsForwarderComponent to the NgModule to fix it. Cannot determine the module for class IwdatablesComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/iwdatables/iwdatables.component.ts! Add IwdatablesComponent to the NgModule to fix it. Cannot determine the module for class CheckOutComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/check-out/check-out.component.ts! Add CheckOutComponent to the NgModule to fix it. Cannot determine the module for class ShipperConsigneeComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/shipper-consignee/shipper-consignee.component.ts! Add ShipperConsigneeComponent to the NgModule to fix it. Cannot determine the module for class BookingDocumentsComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/booking-documents/booking-documents.component.ts! Add BookingDocumentsComponent to the NgModule to fix it. Cannot determine the module for class MyBookingsComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/my-bookings/my-bookings.component.ts! Add MyBookingsComponent to the NgModule to fix it. Cannot determine the module for class LocalChargesTablesComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/local-charges-tables/local-charges-tables.component.ts! Add LocalChargesTablesComponent to the NgModule to fix it. Cannot determine the module for class BlockCopyPasteComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/directives/blockcopypaste.directive.ts! Add BlockCopyPasteComponent to the NgModule to fix it. Cannot determine the module for class ClickOutsideDirective in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/directives/clickOutside.directive.ts! Add ClickOutsideDirective to the NgModule to fix it. Cannot determine the module for class OnlyNumber in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/directives/decimal.directive.ts! Add OnlyNumber to the NgModule to fix it. Cannot determine the module for class DocumentsuploadComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/documentsupload/documentsupload.component.ts! Add DocumentsuploadComponent to the NgModule to fix it. Cannot determine the module for class AlloffersComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/alloffers/alloffers.component.ts! Add AlloffersComponent to the NgModule to fix it. Cannot determine the module for class SearchFilterPipe in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/jobboard/searchfilter.pipe.ts! Add SearchFilterPipe to the NgModule to fix it. Cannot determine the module for class MyoffersComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/myoffers/myoffers.component.ts! Add MyoffersComponent to the NgModule to fix it. Cannot determine the module for class AllbookingsComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/allbookings/allbookings.component.ts! Add AllbookingsComponent to the NgModule to fix it. Cannot determine the module for class AllpaymentsComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/allpayments/allpayments.component.ts! Add AllpaymentsComponent to the NgModule to fix it. Cannot determine the module for class BlockCopyPasteDirective in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/directives/block-copy-paste.directive.ts! Add BlockCopyPasteDirective to the NgModule to fix it. Cannot determine the module for class AppModule in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/app.module.ts! Add AppModule to the NgModule to fix it.
I have removed node_modules and reinstalled again still same issue..
app.module.ts
@NgModule({
declarations: [
AppComponent,
OfferCreationFinalForwarderComponent,
OfferCommonTopComponent,
OfferCommonRightComponent,
TopMenuComponent,
...........
ref link checkthis
回答1:
If ng build
works fine, here are my points you should consider
1) 'apiBaseUrl' does not exist on type '{ production: boolean; }' - check your environment.prod.ts file. Is it having the apiBaseUrl?
2) While running the prod build on the cli, you may have errors with your components and Angular does not specify that it in particular.
Hope this helps
来源:https://stackoverflow.com/questions/52492844/angular-ng-build-prod-issue