运行 子进程 ionic-app-scripts 时发生错误

An error occurred while running subprocess ionic-app-scripts

我是Ionic 3新手,做了一个应用,想转apk。

我正在使用以下 CLI 生成调试(或测试)android-debug.apk:

ionic cordova build android --prod

页面在声明和 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 数组中。尝试在上层模块中添加它。

如果您想在多个模块中使用相同的组件,请尝试将其作为一个单独的模块并在该模块中导出该组件

your.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,
    ],