Angular `ng build --prod` 问题 [英] Angular `ng build --prod` issue

查看:34
本文介绍了Angular `ng build --prod` 问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

when i did --> 'ng build --prod' i got this error

错误:无法确定类 AppComponent 的模块E:/GitNew/Terminal2/Terminal2/terminal2/src/app/app.component.ts!添加AppComponent 到 NgModule 来修复它.
无法确定 OfferCreationFinalForwarderComponent 类的模块在 E:/GitNew/Terminal2/Terminal2/terminal2/src/app/offer-creation-final-转发器/offer-creation-final-forwarder.component.ts!添加向 NgModule 提供CreationFinalForwarderComponent 来修复它.无法确定 E:/GitNew/Terminal2/Terminal2/terminal2/src/app/offer-common-top/offer-common-top.component.ts 中类 OfferCommonTopComponent 的模块!将 OfferCommonTopComponent 添加到 NgModule 以修复它.无法确定 E:/GitNew/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/src/app/shipper-common-right-menu/shipper-common-right-menu.component.ts 中类 ShipperCommonRightMenuComponent 的模块!将 ShipperCommonRightMenuComponent 添加到 NgModule 以修复它.无法确定 E:/GitNew/Terminal2/Terminal2/terminal2/src/app/booking-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/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/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/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/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/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/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/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/src/app/allbookings/allbookings.component.ts 中类 AllbookingsComponent 的模块!将 AllbookingsComponent 添加到 NgModule 以修复它.无法确定 E:/GitNew/Terminal2/Terminal2/terminal2/src/app/allpayments/allpayments.component.ts 中类 AllpaymentsComponent 的模块!将 AllpaymentsComponent 添加到 NgModule 以修复它.无法确定 E:/GitNew/Terminal2/Terminal2/terminal2/src/app/directives/block-copy-paste.directive.ts 中类 BlockCopyPasteDirective 的模块!将 BlockCopyPasteDirective 添加到 NgModule 以修复它.无法确定 E:/GitNew/Terminal2/Terminal2/terminal2/src/app/app.module.ts 中类 AppModule 的模块!将 AppModule 添加到 NgModule 以修复它.

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.

我已经删除了 node_modules 并重新安装了同样的问题..

I have removed node_modules and reinstalled again still same issue..

app.module.ts

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

参考链接 checkthis

推荐答案

如果 ng build 工作正常,这里是你应该考虑的我的观点

If ng build works fine, here are my points you should consider

1) 'apiBaseUrl' 不存在于类型 '{ production: boolean;}' - 检查您的 environment.prod.ts 文件.它有 apiBaseUrl 吗?

1) 'apiBaseUrl' does not exist on type '{ production: boolean; }' - check your environment.prod.ts file. Is it having the apiBaseUrl?

2) 在 cli 上运行 prod 构建时,您的组件可能会出错,而 Angular 没有特别指定它.

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.

希望能帮到你

这篇关于Angular `ng build --prod` 问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆