簡體   English   中英

運行子進程 ionic-app-scripts 時出錯

[英]An error occurred while running subprocess ionic-app-scripts

我是 Ionic 3 的新手。我做了一個應用程序並嘗試轉換為 apk。

我正在使用以下 CLI 生成調試(或測試)android-debug.apk:

ionic cordova build android --prod

Page 在聲明和 entryComponents 中聲明。

這是我的app.module.ts

@NgModule({
  declarations: [
    MyApp,
    AboutPage,
    ContactPage,
    HomePage,
    TabsPage,
    LoginPage,
    MobileScreenPage,
    OtpScreenPage,
    RegisterPage,
    ForgotPasswordPage,
    EditProfilePage,
    MemberDetailPage
  ],
  imports: [
    BrowserModule,
    HttpClientModule,
    IonicModule.forRoot(MyApp)
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    AboutPage,
    ContactPage,
    HomePage,
    TabsPage,
    LoginPage,
    MobileScreenPage,
    OtpScreenPage,
    RegisterPage,
    ForgotPasswordPage,
    EditProfilePage,
    MemberDetailPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    {provide: ErrorHandler, useClass: IonicErrorHandler},
    AuthServiceProvider
  ]
})
export class AppModule {}

錯誤:

在此處輸入圖片說明

您將相同的組件放在多個 ngModule 數組中。 嘗試將其添加到上層模塊中。

如果您想在多個模塊中使用相同的組件,請嘗試使其成為一個單獨的模塊並在該模塊中導出該組件

你的.module.ts

 declarations: [
        YourComponent,
    ],
    imports: [
        CommonModule,
        ReactiveFormsModule,
    ],
    exports: [YourComponent]

編輯:1

您不能在多個模塊中注冊一個組件。 如果您想要多個不同模塊中的相同組件。 嘗試使該組件成為一個單獨的模塊,並在您想要的任何位置導入該模塊。 在您的情況下,從應用程序模塊的聲明中刪除 EditProfilePage 並在您的 EditProfilePageModule 中添加這一行。

EditProfilePageModule.ts

exports: [EditProfilePage]

現在在你的 app.module.ts 中導入 EditProfilePage 模塊

app.module.ts

imports: [
        CommonModule,
        EditProfilePageModule,
    ],

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM