[英]Error: Type LoginComponent is part of the declarations of 2 modules: LoginModule and AppModule
[英]Build Error “Type …. is part of the declarations of 2 modules: AppModule - Ionic
我正在嘗試為 android 創建我的 APK 並運行以下命令:
ionic cordova run android --prod --release
離子版本:離子V3
我的應用程序沒有進行延遲加載(我什至不知道該怎么做,哈哈)而且我已經使用 ionic cli 創建了每個頁面。
當我運行上面的命令時,出現以下錯誤:
錯誤:在 C:/Users/tamo/Desktop/dpHydmech/Hydmech/src/pages/automatic/automatic.ts 中鍵入 AutomaticPage 是 2 個模塊聲明的一部分:C:/Users/tamo/Desktop/dpHydmech/Hydmech 中的 AppModule C:/Users/tamo/Desktop/dpHydmech/Hydmech/src/pages/automatic/automatic.module.ts 中的 /src/app/app.module.ts 和 AutomaticPageModule!
請考慮將 C:/Users/tamo/Desktop/dpHydmech/Hydmech/src/pages/automatic/automatic.ts 中的 AutomaticPage 移動到更高的模塊,該模塊在 C:/Users/tamo/Desktop/dpHydmech/Hydmech/src/ 中導入 AppModule應用程序/app.module.ts
和 C:/Users/tamo/Desktop/dpHydmech/Hydmech/src/pages/automatic/automatic.module.ts 中的 AutomaticPageModule。 您還可以創建一個新的 NgModule,在 C:/Users/tamo/Desktop/dpHydmech/Hydmech/src/pages/automatic/automatic.ts 中導出並包含 AutomaticPage
然后在 C:/Users/tamo/Desktop/dpHydmech/Hydmech/src/app/app.module.ts 中的 AppModule 中導入 NgModule 和 C:/Users/tamo/Desktop/dpHydmech/Hydmech/src/pages/automatic 中的 AutomaticPageModule /automatic.module.ts。
我嘗試過的事情:
我看了一下這個:
有關如何解決此問題的任何建議?
在我看來,這是因為您在兩個模塊中添加了 automatic.ts。 所以如果你刪除一個它會運行良好
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.