Ionic v5 migration v7 (ion-x unknown element)

Error: src/app/app.component.html:59:5 - error NG8001: ‘ion-router-outlet’ is not a known element:
[ng] 1. If ‘ion-router-outlet’ is an Angular component, then verify that it is part of this module.
[ng] 2. If ‘ion-router-outlet’ is a Web Component then add ‘CUSTOM_ELEMENTS_SCHEMA’ to the ‘@NgModule.schemas’ of this component to suppress this message.
[ng]
[ng] 59
[ng] ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ng]
[ng] src/app/app.component.ts:41:16
[ng] 41 templateUrl: ‘app.component.html’,
[ng] ~~~~~~~~~~~~~~~~~~~~
[ng] Error occurs in the template of component AppComponent.
app.module.ts :
@NgModule({
declarations: [AppComponent],
imports: [
IonRouterOutlet,
BrowserModule,
HttpModule,
HttpClientModule,
AppRoutingModule,
IonicModule.forRoot({
_forceStatusbarPadding: false,
rippleEffect: false,
menuType: ‘overlay’,
mode: ‘md’
}),
AppRoutingModule,
CommonModule
],
providers: [
StatusBar,
SplashScreen,
Network,
AppVersion,
LocalNotifications,
FileTransfer,
FileTransferObject,
FCM,
File,
HTTP,
Media,
FileOpener,
EmailComposer,
Device,
AndroidPermissions,
YoutubeVideoPlayer,
// GooglePlus,
// Facebook,
DatePicker,
SocialSharing,
DatePicker,
CallNumber,
AppRate,
Media,
InAppBrowser,
{ provide: RouteReuseStrategy, useClass: IonicRouteStrategy },
// { provide: ErrorHandler, useClass: IonicErrorHandler },
Api,
User,
AppComponent,
DatePipe,
GlobalDataService,
LoginUserData,
LoginResponse,
AllContactDetails,

//services
AppSettingsService,
{ provide: APP_INITIALIZER, useFactory: (config: AppSettingsService) => () => config.loadSettings(), deps: [AppSettingsService], multi: true, useClass: IonicRouteStrategy }

],
// schemas: [
// CUSTOM_ELEMENTS_SCHEMA,
// NO_ERRORS_SCHEMA
// ],
bootstrap: [AppComponent],

})

export class AppModule { }

app-routing.modules.ts :
@NgModule({
imports: [
IonicModule,
IonRouterOutlet,
RouterModule.forRoot(routes, { preloadingStrategy: PreloadAllModules })
],
exports: [RouterModule]
})
export class AppRoutingModule { }

I’d recommend spinning up an Ionic template project with the router to see how things are set up by default. In your case it sounds like you’re missing an import for RouterModule (with the .forRoot method) in your app-routing.module.ts. This error generally just means you’re missing an import for the thing that defines ion-router-outlet (or whatever it may be) in your module.