# Npm run ionic:build --prod giving error

**URL:** <https://forum.ionicframework.com/t/npm-run-ionic-build-prod-giving-error/128629>\
**Category:** ionic-v3\
**Created:** [April 23, 2018, 7:18am UTC](https://forum.ionicframework.com/t/npm-run-ionic-build-prod-giving-error/128629 "2018-04-23T07:18:59Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ersaurabh101](https://avatars.discourse-cdn.com/v4/letter/e/76d3ee/32.png) [@ersaurabh101](https://forum.ionicframework.com/u/ersaurabh101)\
**Post date:** [April 23, 2018, 7:18am UTC](https://forum.ionicframework.com/t/npm-run-ionic-build-prod-giving-error/128629/1 "2018-04-23T07:18:59Z")

</div>

When I am trying to run `npm run ionic:build --prod`, it is giving me below errors:

> Error: Cannot determine the module for class OverlayPortal in  
> F:/D/IONIC/quicktask/quicktask-web-froala/node\_modules/ionic-angular/umd/components/app/overlay-portal.d.ts!  
> Add OverlayPortal to the NgModule to fix it. Cannot determine the module for class IonicApp in  
> F:/D/IONIC/quicktask/quicktask-web-froala/node\_modules/ionic-angular/umd/components/app/app-root.d.ts! Add  
> IonicApp to the NgModule to fix it. Cannot determine the module for class ClickBlock in  
> F:/D/IONIC/quicktask/quicktask-web-froala/node\_modules/ionic-angular/umd/components/app/click-block.d.ts!  
> Add ClickBlock to the NgModule to fix it. Cannot determine the module for class Slides in  
> F:/D/IONIC/quicktask/quicktask-web-froala/node\_modules/ionic-angular/umd/components/slides/slides.d.ts! Add  
> Slides to the NgModule to fix it.

What do I do to build using `--prod`. PLEASE HELP.

Please advise.

**Find below my app.module.ts**

`app.module.ts`

```
import { BrowserModule } from '@angular/platform-browser';
import { ErrorHandler, NgModule } from '@angular/core';
import { App, NavController, IonicErrorHandler, IonicModule,IonicApp } from 'ionic-angular'; // removed IonicApp from here

import { MyApp } from './app.component';
import { HomePage } from '../pages/home/home';
import { ListPage } from '../pages/list/list';
import { LoginPage } from '../pages/login/login';
import { NewtaskPage } from '../pages/newtask/newtask';
//import { DashboardPage } from '../pages/dashboard/dashboard';
import { TaskgivenPage } from '../pages/taskgiven/taskgiven';
import { MytaskPage } from '../pages/mytask/mytask';

import { CommunicationPage } from '../pages/communication/communication';

import { CommunicationgivenPage } from '../pages/communicationgiven/communicationgiven';
import { CommunicationreportPage } from '../pages/communicationreport/communicationreport';
import { GivencommunicationclosedPage } from '../pages/givencommunicationclosed/givencommunicationclosed';

import { TestPage } from '../pages/test/test';
import { LogoutPage } from '../pages/logout/logout';
import { MyclosedtaskPage } from '../pages/myclosedtask/myclosedtask';
import { GivenclosedtaskPage } from '../pages/givenclosedtask/givenclosedtask';
import { ReporttoPage } from '../pages/reportto/reportto';
import { SlidePage } from '../pages/slide/slide';

import { StatusBar } from '@ionic-native/status-bar';
import { SplashScreen } from '@ionic-native/splash-screen';
//import { Firebase } from '@ionic-native/firebase';
import { SpeechRecognition } from '@ionic-native/speech-recognition';

import { Headers, Http, HttpModule ,Response } from '@angular/http';
import { IonicStorageModule } from '@ionic/storage';

import { TimeAgoPipe } from 'time-ago-pipe';

import {Commopen} from '../pages/givencommunicationclosed/commopen';
import { Userimage } from '../pages/dashboard2/userimage';

import { MycommclosedPage } from '../pages/mycommclosed/mycommclosed';
import { Dashboard2Page } from '../pages/dashboard2/dashboard2';
import { MytaskuserwisePage } from '../pages/mytaskuserwise/mytaskuserwise';
import { ProfilePage } from '../pages/profile/profile';
import { PaymentPage } from '../pages/payment/payment';
import { InAppBrowser } from '@ionic-native/in-app-browser';
import { InfoPage } from '../pages/info/info';
import { PerformancePage } from '../pages/performance/performance';
import { PopoverPage } from '../pages/communicationgiven/popover';
import { Updatepopup} from '../pages/communicationgiven/updatepopup';
import { TimelinePage } from '../pages/timeline/timeline';
import { Commpopup } from '../pages/timeline/commpopup';
import {SearchPage} from '../pages/search/search';
import {SuggestionPage} from '../pages/suggestion/suggestion';
import {Mytaskpopup} from '../pages/mytask/mytaskpopup';
import {Userwisepopup} from '../pages/mytaskuserwise/userwisepopup';
import {Taskgivenpopup} from '../pages/taskgiven/taskgivenpopup';
import {Reportpopup} from '../pages/reportto/reportpopup';
import {FollowerPage} from '../pages/follower/follower';
import {CommfollowerPage} from '../pages/commfollower/commfollower';
import { CommPage } from '../pages/comm/comm';
import {ReportsPage} from '../pages/reports/reports';
import { DashmodalPage } from '../pages/dashmodal/dashmodal';
import { Dashmodal1Page } from '../pages/dashmodal1/dashmodal1';
import { LabelPage } from '../pages/label/label';
import { SortPage } from '../pages/sort/sort';
import { SortuserwisePage } from '../pages/sortuserwise/sortuserwise';
import { LastseenPage } from '../pages/lastseen/lastseen';
import { MemolistPage } from '../pages/memolist/memolist';
import { OfcmemoPage } from '../pages/ofcmemo/ofcmemo';
import { CommadminPage } from '../pages/commadmin/commadmin';
import { AdminpcPage } from '../pages/adminpc/adminpc';

import {AiPage} from '../pages/ai/ai';
import { Autosize } from '../directives/autosize/autosize';

// Import Froala Editor.
import "froala-editor/js/froala_editor.pkgd.min.js";
import { NoSanitizePipe } from '../pipes/no-sanitize/no-sanitize';

// Import Angular2 plugin.
import { FroalaEditorModule, FroalaViewModule } from 'angular-froala-wysiwyg';
import {Nl2BrPipeModule} from 'nl2br-pipe';
import {LinkyModule} from 'angular-linky';

//Search
import { SelectSearchableModule } from 'ionic-select-searchable';

// for ionic build --prod errors or aot compilation
// import { OverlayPortal } from '../../node_modules/ionic-angular/umd/components/app/overlay-portal.d';
//import { IonicApp } from '../../node_modules/ionic-angular/umd/components/app/app-root.d';
//import { ClickBlock } from '../../node_modules/ionic-angular/umd/components/app/click-block.d';
//import { Slides } from '../../node_modules/ionic-angular/umd/components/slides/slides.d';
import { FilterArrayPipe } from '../pages/dashboard2/filterpipe';
import {IonicPage, NavParams, Slides} from 'ionic-angular';

@NgModule({
  declarations: [
  // OverlayPortal, //for aot compilation
 // IonicApp , //for aot compilation for app-root.d
  // ClickBlock, //for aot compilation
  // Slides, //for aot compilation
  IonicApp,
    FilterArrayPipe, //for aot compilation
    TimeAgoPipe,
    MyApp,
    HomePage,
    ListPage,
    LoginPage,
    NewtaskPage,
   // DashboardPage,
    TaskgivenPage,
    MytaskPage,
    CommunicationPage,
    CommunicationgivenPage,
CommunicationreportPage,
GivencommunicationclosedPage,    
    TestPage,
    LogoutPage,
    MyclosedtaskPage,
    GivenclosedtaskPage,
    ReporttoPage,
    Dashboard2Page,
    MytaskuserwisePage,
    MycommclosedPage,
    ProfilePage,
    PaymentPage,
    InfoPage,
    SlidePage,
    PerformancePage ,
    PopoverPage,
    Updatepopup,
    SearchPage,
    TimelinePage,
    Commpopup,
    SuggestionPage,
    Mytaskpopup,
    Userwisepopup,
    Taskgivenpopup,
    Reportpopup,
    AiPage,
    Autosize,
    NoSanitizePipe,
    FollowerPage,
    CommfollowerPage,
    CommPage,
    ReportsPage,
    DashmodalPage,
    Dashmodal1Page,
    LabelPage,
    SortPage,
    SortuserwisePage,
    LastseenPage,
    MemolistPage,
    OfcmemoPage,
    CommadminPage,
    AdminpcPage,
    //OverlayPortal
  ],
  imports: [
    BrowserModule,
    HttpModule,
    Nl2BrPipeModule,
    LinkyModule,
    SelectSearchableModule,
    IonicModule.forRoot(MyApp),
    FroalaEditorModule.forRoot(),
    FroalaViewModule.forRoot(),
    IonicStorageModule.forRoot()
  ],
  bootstrap: [IonicApp],
  entryComponents: [
    MyApp,
    HomePage,
    ListPage,
    LoginPage,
    NewtaskPage,
   // DashboardPage,
    TaskgivenPage,
    MytaskPage,
    CommunicationPage,
    CommunicationgivenPage,
    CommunicationreportPage, 
    GivencommunicationclosedPage,
    TestPage,
    LogoutPage,
    MyclosedtaskPage,
    GivenclosedtaskPage,
    ReporttoPage,
    Dashboard2Page,
    MytaskuserwisePage,
    MycommclosedPage,
    ProfilePage,
    PaymentPage,
    InfoPage,
    SlidePage,
    PerformancePage,
    PopoverPage,
    Updatepopup,
    SearchPage,
    TimelinePage,
    Commpopup,
    SuggestionPage,
    Mytaskpopup,
    Userwisepopup,
    Taskgivenpopup,
    Reportpopup,
    AiPage,
    FollowerPage,
    CommfollowerPage,
    CommPage,
    ReportsPage,
    DashmodalPage,
    Dashmodal1Page,
    LabelPage,
    SortPage,
    SortuserwisePage,
    LastseenPage,
    MemolistPage,
    OfcmemoPage,
    CommadminPage,
    AdminpcPage
  ],
  providers: [
    StatusBar,
    SplashScreen,
    //Firebase,
    Commopen,
    GivenclosedtaskPage,
    Userimage,
    InAppBrowser,
    SpeechRecognition,
    {provide: ErrorHandler, useClass: IonicErrorHandler}
  ]
})
export class AppModule {}

```

My ionic info:

> cli packages: (C:\Users\jessica\AppData\Roaming\npm\node\_modules)

```
@ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0

```

global packages:

```
cordova (Cordova CLI) : 8.0.0

```

local packages:

```
@ionic/app-scripts : 3.1.9
Cordova Platforms : android 6.2.3 browser 5.0.1
Ionic Framework : ionic-angular 3.8.0

```

System:

```
Android SDK Tools : 25.2.5
Node : v6.10.3
npm : 5.4.2
OS : Windows 8.1

```

Environment Variables:

```
ANDROID_HOME : C:\Program Files (x86)\Android\android-sdk

```

Misc:

```
backend : legacy

```

---

<div class="post-metadata">

**Author:** ![brassier](https://avatars.discourse-cdn.com/v4/letter/b/5daacb/32.png) [@brassier](https://forum.ionicframework.com/u/brassier)\
**Post date:** [June 14, 2018, 1:04pm UTC](https://forum.ionicframework.com/t/npm-run-ionic-build-prod-giving-error/128629/2 "2018-06-14T13:04:16Z")

</div>

I had a similar error which was caused by import inconsistencies. See here for more info:

> <https://stackoverflow.com/questions/46599017/error-cannot-determine-the-module-for-class-overlayportal-in-prod/50858210#50858210>

---

<div class="post-metadata">

**Author:** ![mhartington](https://sea1.discourse-cdn.com/ionicframework/user_avatar/forum.ionicframework.com/mhartington/32/137757_2.png) [@mhartington](https://forum.ionicframework.com/u/mhartington)\
**Post date:** [July 19, 2021, 9:38pm UTC](https://forum.ionicframework.com/t/npm-run-ionic-build-prod-giving-error/128629/3 "2021-07-19T21:38:55Z")

</div>


