Unnati Patadia
Unnati Patadia

Reputation: 732

An error occurred while running subprocess ionic-app-scripts

I am a newbie to Ionic 3. I have done an application and tried to convert to apk.

I am generating debug (or testing) android-debug.apk using below CLI :

ionic cordova build android --prod

Page declares in declarations and entryComponents.

This is my 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 {}

Error:

enter image description here

Upvotes: 0

Views: 516

Answers (1)

Ali Wahab
Ali Wahab

Reputation: 592

You are putting same component in multiple ngModule array. Try to add this in upper level module.

If you want to use same component in multiple modules try to make it a separate module and export that component in that module

your.module.ts

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

Edit: 1

You can not register one component in multiple modules. If you want same component in multiple different modules. Try to make make that component a separate module and import that module where ever you want. In your case, remove EditProfilePage from app module's declarations and add this line in your EditProfilePageModule.

EditProfilePageModule.ts

exports: [EditProfilePage]

Now in your app.module.ts import the EditProfilePage module

app.module.ts

imports: [
        CommonModule,
        EditProfilePageModule,
    ],

Upvotes: 1

Related Questions