Cannot determine the module for class IonicApp command: ionic cordova build <platform> --prod --release failure

Hi @brassier,

This is one of first things I tried after reading this SO post… https://stackoverflow.com/questions/46599017/error-cannot-determine-the-module-for-class-overlayportal-in-prod/50858210#50858210

I ran grep -rl "ionic-angular\/" . in the source tree, but no matches were found.

I’m running out of ideas, other than building a new project and incorporating the various components one by one until the build breaks when running ionic build --prod. This approach is going to be long and messy to execute with so many components involved :frowning:

I was kind of hoping I could override the parameters of ngc to show some kind of trace, however there doesn’t seem to be an option for this.

What fixed this for me (made sure there were no submodules of ionic-angular being imported) was downgrading from TypeScript 2.9.2 to 2.7.2.

3 Likes

Thank you @disseminate! This worked like a dream. My TS version was 2.8.1. The downgrade to 2.7.2 fixed the problem.

Thanks for saving me days of work!

Yes, I confirm - Typescript 2.7.2 solved this issue in my case. Many thanks!

I had the exact same problem, and actually it disappeared after removing node_modules and reinstalling the packages.

where you replace this parameter ?

its works for me, thank you very much @disseminate

I’m facing same issue and my typescript is “typescript”: “2.4.2”. And i’m also try this Typescript 2.7.2, but facing the same issue, please help.
37%20PM

I think that none of the answers were tackling this error correctly.

here is a fix that worked for me.

in app.module.ts, add this:

import { OverlayPortal } from 'ionic-angular/components/app/overlay-portal';
import { ClickBlock } from 'ionic-angular/components/app/click-block';
import {IonicApp as IonicAppRoot} from 'ionic-angular/components/app/app-root';

...


declarations: [
    ...

    OverlayPortal,
    IonicAppRoot,
    ClickBlock,
  ],