error NG6002: 出现在AppModule的NgModule.imports,但本身有错误AppRoutingModule

error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors AppRoutingModule

当我制作:ionic cap build android --prod --release 时,出现此错误:

Error: src/app/app-routing.module.ts:60:14 - error NG6002: Appears in the NgModule.imports of AppModule, but itself has errors

export class AppRoutingModule {}

我刚做的时候没有这个错误:ionic cap build android。我在论坛上尝试了不同的提议,但没有人工作

应用-routing.module.ts :

    import { NgModule } from '@angular/core';
    import { PreloadAllModules, RouterModule, Routes } from '@angular/router';
    import { TranslateService } from '@ngx-translate/core';

    const routes: Routes = [
    {
        path: 'HomePage',
        loadChildren: () => import('./pages/home/home.module').then(m => m.HomePageModule)
    },
    {
        path: 'IntroPage',
        loadChildren: () => import('./pages/intro/intro.module').then(m => m.IntroPageModule)
    },
    {
        path: 'HowPage',
        loadChildren: () => import('./pages/how/how.module').then(m => m.HowPageModule)
    },
    {
        path: 'AboutPage',
        loadChildren: () => import('./pages/about/about.module').then(m => m.AboutPageModule)
    },
    {
        path: 'SettingsPage',
        loadChildren: () => import('./pages/settings/settings.module').then(m => m.SettingsPageModule)
    },
    {
        path: 'ModalPage',
        loadChildren: () => import('./pages/modal/modal.module').then(m => m.ModalPageModule)
    },
    {
        path: '',
        redirectTo: 'HomePage',
        pathMatch: 'full'
    },
    ];

    @NgModule({
        imports: [
            RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
      ],
        exports: [RouterModule, TranslateService]
    })
    export class AppRoutingModule {}

app.module.ts :

    import { NgModule } from '@angular/core';
    import { BrowserModule } from '@angular/platform-browser';
    import { RouteReuseStrategy } from '@angular/router';
    import { HttpClientModule, HttpClient } from '@angular/common/http';

    import { IonicModule, IonicRouteStrategy } from '@ionic/angular';
    import { IonicStorageModule } from '@ionic/storage-angular';

    import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
    import { TranslateHttpLoader } from '@ngx-translate/http-loader';

    import { AppComponent } from './app.component';
    import { AppRoutingModule } from './app-routing.module';

    import { GlobalProvider } from './providers/global/global';

    import { CMHPlugin } from '@ionic-native/cmh-plugin/ngx';

    export function createTranslateLoader(http: HttpClient) {
        return new TranslateHttpLoader(http, './assets/i18n/', '.json');
    }

    @NgModule({
        declarations: [AppComponent],
        imports: [
            HttpClientModule,
            BrowserModule,
            IonicModule.forRoot(),
            IonicStorageModule.forRoot(),
            AppRoutingModule,
            TranslateModule.forRoot({
                loader: {
                    provide: TranslateLoader,
                    useFactory: (createTranslateLoader),
                    deps: [HttpClient]
                },
                defaultLanguage: 'en',
            })
        ],
        providers: [GlobalProvider, CMHPlugin, { provide: RouteReuseStrategy, useClass: IonicRouteStrategy }],
        bootstrap: [AppComponent]
    })
    export class AppModule {}

我用的是Ionic 6和Angular 13。如果你需要,我可以给更多information/code。

我在 app-routing.module.ts 的 export [] 中删除了 TranslateService 并且它有效!