Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: Cannot determine the module for class OverlayPortal in --prod

i am not sure i am facing an issue only with ionic cordova run android --prod and my ionic cordova run android works fine.

ERROR:

Error: Cannot determine the module for class OverlayPortal in /Users/gopi/Documents/bos/hybrid-app/node_modules/ionic-angular/es2015/components/app/overlay-portal.d.ts! Add OverlayPortal to the NgModule to fix it.
Cannot determine the module for class IonicApp in /Users/gopi/Documents/bos/hybrid-app/node_modules/ionic-angular/es2015/components/app/app-root.d.ts! Add IonicApp to the NgModule to fix it.
Cannot determine the module for class ClickBlock in /Users/gopi/Documents/bos/hybrid-app/node_modules/ionic-angular/es2015/components/app/click-block.d.ts! Add ClickBlock to the NgModule to fix it.
Cannot determine the module for class Slides in /Users/gopi/Documents/bos/hybrid-app/node_modules/ionic-angular/es2015/components/slides/slides.d.ts! Add Slides to the NgModule to fix it.

Can some one give me clear explaination:

Here is my ionic info

cli packages: (/usr/local/lib/node_modules)

@ionic/cli-utils  : 1.9.2
ionic (Ionic CLI) : 3.9.2

global packages:

Cordova CLI : 7.0.1

local packages:

@ionic/app-scripts : 1.3.8
Cordova Platforms  : android 6.2.3 ios 4.4.0
Ionic Framework    : ionic-angular 3.4.2

System:

Android SDK Tools : 25.2.5
Node              : v6.11.1
npm               : 3.10.10
OS                : macOS Sierra
Xcode             : Xcode 8.3.2 Build version 8E2002
like image 810
Mohan Gopi Avatar asked Oct 06 '17 05:10

Mohan Gopi


3 Answers

I finally found a fix for this. I had a few imports from ionic-angular that imported the nested component directly as opposed to importing from the top-level package export. I'm guessing the prod AOT compiler didn't like having some imports from the top-level and some directly to the nested item. An example for me is below. My guess is you could choose either one of these approaches, but when mixing them the AOT compiler won't be happy.

Good

import { LoadingController } from 'ionic-angular';

Bad

import { LoadingController } from 'ionic-angular/components/loading/loading-controller';

like image 137
BRass Avatar answered Nov 10 '22 04:11

BRass


This will help you to solve this issue.

https://stackoverflow.com/a/55832874/849870

i solve my problem. in my project i was using an outdated module, ion-datepicker if you are also using same issue, here are some steps, you can follow and find your infected or outdated module.

1. Step one:

in your project find in all files from 'ionic-angular/ word,

2. Step Two:

if you find this word like import { xyz } from 'ionic-angular/xyz/abc'

update or remove that module.

like image 6
Umer Ch Avatar answered Nov 10 '22 03:11

Umer Ch


This solution worked for me. After you install all your components with npm i, install alone typescript version 2.8.1

npm install [email protected]

run build again

like image 5
Artux White Avatar answered Nov 10 '22 03:11

Artux White