How to solve error due to ''ionic cordova run android --prod'' please?

Mac-mini-de-onegate:neop onegate$ ionic cordova run android --prod
Running app-scripts build: --prod --address 0.0.0.0 --port 8100 --p 8100 --livereload-port 35729 --r 35729 --iscordovaserve --externalIpRequired --nobrowser

[14:10:16] build prod started …
[14:10:16] clean started …
[14:10:16] clean finished in 3 ms
[14:10:16] copy started …
[14:10:16] ngc started …
[WARN] Error occurred during command execution from a CLI plugin (@ionic/cli-plugin-cordova). Your plugins may be out of
date.
Error: Type AccueilPage in /Users/onegate/CloudStation/Onegate-Apps/Neop 2/neop/src/pages/accueil/accueil.ts is part of the declarations of 2 modules: AppModule in /Users/onegate/CloudStation/Onegate-Apps/Neop 2/neop/src/app/app.module.ts and AccueilPageModule in /Users/onegate/CloudStation/Onegate-Apps/Neop 2/neop/src/pages/accueil/accueil.module.ts! Please consider moving AccueilPage in /Users/onegate/CloudStation/Onegate-Apps/Neop 2/neop/src/pages/accueil/accueil.ts to a higher module that imports AppModule in /Users/onegate/CloudStation/Onegate-Apps/Neop 2/neop/src/app/app.module.ts and AccueilPageModule in /Users/onegate/CloudStation/Onegate-Apps/Neop 2/neop/src/pages/accueil/accueil.module.ts. You can also create a new NgModule that exports and includes AccueilPage in /Users/onegate/CloudStation/Onegate-Apps/Neop 2/neop/src/pages/accueil/accueil.ts then import that NgModule in AppModule in /Users/onegate/CloudStation/Onegate-Apps/Neop 2/neop/src/app/app.module.ts and AccueilPageModule in /Users/onegate/CloudStation/Onegate-Apps/Neop 2/neop/src/pages/accueil/accueil.module.ts.

Try update that cli plugin :slight_smile:

i tried , but nothing change.

that’s my command : npm update @ionic/cli-plugin-cordova ; but the plugin still outdated :worried:

Try checking config.xml for any conflit. Maybe you need to update plugins you are using.

The issue is that you have a page declared in 2 modules, accueil.ts is in de app,module.ts and in the AccueilPageModule, so you should either remove the page from the app,module.ts and lazy loaded, or remove it from the AccueilPageModule, there’s nothing wrong with your plugins, that’s just a generic error that the cli throws when the build goes wrong,

check this video for more information about modules and lazy loading

1 Like