有角的ng build --prod`问题

时间:2018-09-25 07:30:34

标签: angular5 node-modules ngmodel ng-build

当我这样做的时候 ->'ng build --prod' 我收到此错误

  

ERROR in:无法确定以下类中AppComponent类的模块        E:/GitNew/Terminal2/Terminal2/terminal2/src/app/app.component.ts!加       将AppComponent修复到NgModule中。
      无法确定类OfferCreationFinalForwarderComponent的模块       在E:/ GitNew / Terminal2 / Terminal2 / terminal2 / src / app / offer-creation-final-       forwarder / offer-creation-final-forwarder.component.ts!加        OfferCreationFinalForwarderComponent可以修复到NgModule。无法在E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/offer-common-top/offer-common-top.component.ts中确定OfferCommonTopComponent类的模块!将OfferCommonTopComponent添加到NgModule进行修复。在E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/offer-common-right/offer-common-right.component.ts中无法确定类OfferCommonRightComponent的模块!将OfferCommonRightComponent添加到NgModule进行修复。在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/top-menu/top-menu.component.ts中无法确定类TopMenuComponent的模块!将TopMenuComponent添加到NgModule中进行修复。无法确定E:/GitNew/Terminal2/Terminal2/terminal2/src/app/booking-creation/booking-creation.component.ts中的BookingCreationComponent类的模块!将BookingCreationComponent添加到NgModule进行修复。在E:/GitNew/Terminal2/Terminal2/terminal2/terminal2/src/app/shipper-common-right-menu/shipper-common-right-menu.component.ts中无法确定ShipperCommonRightMenuComponent类的模块!将ShipperCommonRightMenuComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/book/shipping-shipper-common-top/booking-shipper-common-top.component.ts中确定BookingShipperCommonTopComponent类的模块!将BookingShipperCommonTopComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/jobboard/jobboard.component.ts中确定JobboardComponent类的模块!将JobboardComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/log-in/log-in.component.ts中确定类LogInComponent的模块!将LogInComponent添加到NgModule中进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/registration/registration.component.ts中确定类RegistrationComponent的模块!将RegistrationComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/top-menu-registration/top-menu-registration.component.ts中确定类TopMenuRegistrationComponent的模块!将TopMenuRegistrationComponent添加到NgModule中进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/home/home.component.ts中确定类HomeComponent的模块!将HomeComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/documents/documents.component.ts中确定DocumentsComponent类的模块!将DocumentsComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/market-place/market-place.component.ts中确定MarketPlaceComponent类的模块!将MarketPlaceComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/shipper-letter-instruction/shipper-letter-instruction.component.ts中确定ShipperLetterInstructionComponent类的模块!将ShipperLetterInstructionComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/Terminal2/src/app/acceptance/acceptance.component.ts中确定类AcceptanceComponent的模块!将AcceptanceComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/final-charges/final-charges.component.ts中确定FinalChargesComponent类的模块!将FinalChargesComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/bookings-forwarder/bookings-forwarder.component.ts中确定BookingsForwarderComponent类的模块!将BookingsForwarderComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/iwdatables/iwdatables.component.ts中确定IwdatablesComponent类的模块!将IwdatablesComponent添加到NgModule中进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/check-out/check-out.component.ts中为CheckOutComponent类确定模块!将CheckOutComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/shipper-consignee/shipper-consignee.component.ts中确定ShipperConsigneeComponent类的模块!将ShipperConsigneeComponent添加到NgModule中进行修复。无法确定E:/GitNew/Terminal2/Terminal2/terminal2/src/app/booking-documents/booking-documents.component.ts中的BookingDocumentsComponent类的模块!将BookingDocumentsComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/my-bookings/my-bookings.component.ts中确定MyBookingsComponent类的模块!将MyBookingsComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/local-charges-tables/local-charges-tables.component.ts中确定LocalChargesTablesComponent类的模块!将LocalChargesTablesComponent添加到NgModule进行修复。在E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/directives/blockcopypaste.directive.ts中无法确定类BlockCopyPasteComponent的模块!将BlockCopyPasteComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/directives/clickOutside.directive.ts中确定类ClickOutsideDirective的模块!将ClickOutsideDirective添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/directives/decimal.directive.ts中确定类OnlyNumber的模块!将OnlyNumber添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/documentsupload/documentsupload.component.ts中确定DocumentsuploadComponent类的模块!将DocumentsuploadComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/alloffers/alloffers.component.ts中确定类AlloffersComponent的模块!将AlloffersComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/jobboard/searchfilter.pipe.ts中确定类SearchFilterPipe的模块!将SearchFilterPipe添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/src/app/myoffers/myoffers.component.ts中确定MyoffersComponent类的模块!将MyoffersComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/allbookings/allbookings.component.ts中确定AllbookingsComponent类的模块!将AllbookingsComponent添加到NgModule进行修复。无法确定E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/allpayments/allpayments.component.ts中的AllpaymentsComponent类的模块!将AllpaymentsComponent添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/Terminal2/terminal2/src/app/directives/block-copy-paste.directive.ts中确定类BlockCopyPasteDirective的模块!将BlockCopyPasteDirective添加到NgModule进行修复。无法在E:/GitNew/Terminal2/Terminal2/terminal2/terminal2/src/app/app.module.ts中确定类AppModule的模块!将AppModule添加到NgModule进行修复。

我已经删除了node_modules并再次重新安装仍然是同样的问题。

app.module.ts

 @NgModule({
   declarations: [
   AppComponent,
   OfferCreationFinalForwarderComponent,
   OfferCommonTopComponent,
   OfferCommonRightComponent,
   TopMenuComponent,
   ...........

参考链接checkthis

1 个答案:

答案 0 :(得分:0)

如果ng build工作正常,那么您应该考虑以下几点

1)''{Base:类型中不存在'apiBaseUrl' }'-检查您的environment.prod.ts文件。它具有apiBaseUrl吗?

2)在cli上运行prod构建时,您的组件可能会出错,并且Angular并未特别指定它。

希望这会有所帮助