Ionic-framework: Module not found: Error: Can't resolve './app.module.ngfactory' ionic-angular 3.9.0

Created on 8 Nov 2017  路  55Comments  路  Source: ionic-team/ionic-framework

Ionic version: (check one with "x")
(For Ionic 1.x issues, please use https://github.com/ionic-team/ionic-v1)
[ ] 2.x
[ ] 3.x
[ ] 4.x

I'm submitting a ... (check one with "x")
[ ] bug report
[ ] feature request

Please do not submit support requests or "How to" questions here. Instead, please use one of these channels: https://forum.ionicframework.com/ or http://ionicworldwide.herokuapp.com/

Current behavior:

Module not found: Error: Can't resolve './app.module.ngfactory'
using description file: E:\Working Project\testpackage.json (relative path: ./src/app)
Field 'browser' doesn't contain a valid alias configuration
after using description file: E:\Working Project\testpackage.json (relative path: ./src/app)
using description file: E:\Working Project\testpackage.json (relative path: ./src/app/app.module.ngfactory)
no extension
Field 'browser' doesn't contain a valid alias configuration
E:\Working Project\testsrcappapp.module.ngfactory doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
E:\Working Project\testsrcappapp.module.ngfactory.ts doesn't exist
.js
Expected behavior:

should build as per info
Steps to reproduce:

Related code:

insert short code snippets here

Other information:
this error comes with production tag only.

Ionic info: (run ionic info from a terminal/cmd prompt and paste output below):

insert the output from ionic info here

@ionic/cli-utils : 1.17.0
ionic (Ionic CLI) : 3.17.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.0.1-201711071727
Cordova Platforms  : android 6.2.3
Ionic Framework    : ionic-angular 3.8.0-201711062059

System:

Android SDK Tools : 25.2.5
Node              : v8.9.0
npm               : 5.5.1
OS                : Windows 10

Most helpful comment

Try run this command

$ ./node_modules/.bin/ngc

It will show the detail error part in your code, it saved my life trying to find what was causing the error. May this can help you.

All 55 comments

Hello! Thank you for opening an issue with us! Would you be able to provide a sample application via GitHub that demonstrates the issue you are having? Thanks for using Ionic!

i updated two apps today. one worked perfectly and other ones got broken.. difficult to provide sample application to you on github. any other info you needs ? with prod tag issue is coming

without production tag .app is getting install in device . but now is running with a angular issue .which they r saying will rectify in next release."Can't bind to 'ngOutletContext' since it isn't a known property of 'ng-template'."

Here are the general instructions that were sent around to testers and some early adopters that we asked to test out the next release:

  1. Blow away node_modules and package-lock.json
  2. Set Typescript to ~2.4.2
  3. Set Angular to 5.0.0
  4. Set @ionic/app-scripts to nightly
  5. Set ionic-angular to nightly
  6. Set @ionic/storage to 2.1.3
  7. Set rxjs to 5.5.2
  8. Run npm install

Double check that all of that was done on your project that is failing.

here it is mine one.

"dependencies": {
    "@angular/common": "5.0.0",
    "@angular/compiler": "5.0.0",
    "@angular/compiler-cli": "5.0.0",
    "@angular/core": "5.0.0",
    "@angular/forms": "5.0.0",
    "@angular/http": "5.0.0",
    "@angular/platform-browser": "5.0.0",
    "@angular/platform-browser-dynamic": "5.0.0",
    "@ionic-native/call-number": "^4.3.2",
    "@ionic-native/camera": "^4.3.2",
    "@ionic-native/core": "4.3.3",
    "@ionic-native/diagnostic": "^4.3.2",
    "@ionic-native/email-composer": "^4.3.2",
    "@ionic-native/facebook": "^4.3.2",
    "@ionic-native/file": "^4.3.2",
    "@ionic-native/file-chooser": "^4.3.2",
    "@ionic-native/file-opener": "^4.3.2",
    "@ionic-native/file-path": "^4.3.2",
    "@ionic-native/file-transfer": "^4.3.2",
    "@ionic-native/geolocation": "^4.3.2",
    "@ionic-native/in-app-browser": "^4.3.2",
    "@ionic-native/launch-navigator": "^4.3.2",
    "@ionic-native/location-accuracy": "^4.3.2",
    "@ionic-native/photo-viewer": "^4.3.2",
    "@ionic-native/splash-screen": "4.3.2",
    "@ionic-native/sqlite": "^4.3.2",
    "@ionic-native/status-bar": "4.3.2",
    "@ionic/storage": "2.1.3",
    "call-number": "^1.0.1",
    "com-sarriaroman-photoviewer": "^1.1.10",
    "cordova-android": "^6.2.3",
    "cordova-plugin-camera": "^2.4.1",
    "cordova-plugin-console": "1.0.5",
    "cordova-plugin-device": "1.1.4",
    "cordova-plugin-email-composer": "^0.8.7",
    "cordova-plugin-facebook4": "^1.9.1",
    "cordova-plugin-file": "^4.3.3",
    "cordova-plugin-file-opener2": "^2.0.19",
    "cordova-plugin-file-transfer": "^1.6.3",
    "cordova-plugin-filechooser": "^1.0.1",
    "cordova-plugin-filepath": "^1.0.2",
    "cordova-plugin-geolocation": "^2.4.3",
    "cordova-plugin-inappbrowser": "^1.7.1",
    "cordova-plugin-request-location-accuracy": "^2.2.1",
    "cordova-plugin-splashscreen": "~4.0.1",
    "cordova-plugin-statusbar": "2.2.2",
    "cordova-plugin-whitelist": "1.3.1",
    "cordova-sqlite-storage": "^2.0.4",
    "cordova.plugins.diagnostic": "^3.6.6",
    "enhanced-resolve": "^3.3.0",
    "firebase": "^4.6.1",
    "ionic-angular": "nightly",
    "ionic-plugin-keyboard": "~2.2.1",
    "ionic2-auto-complete": "^1.5.2-beta",
    "ionic2-rating": "^1.2.2",
    "ionicons": "3.0.0",
    "moment": "^2.18.1",
    "mx.ferreyra.callnumber": "~0.0.2",
    "promise-polyfill": "6.0.2",
    "rxjs": "^5.5.2",
    "sw-toolbox": "3.6.0",
    "uk.co.workingedge.phonegap.plugin.launchnavigator": "^4.0.4",
    "zone.js": "^0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "nightly",
    "ionic": "3.17.0",
    "typescript": "2.4.2"
  },

i checked all is fine with given instruction

You need to use the "three-backticks-markdown" in your dependencies comment if you want it to display in any sort of readable form. Like this:

```
your package.json stuff here
```

migrated 3 apps to angular 5 ionic nightly.... two are working fine. one have this issue

I had this issue, deleting node_modules and package-lock.json and the build folder for good measure, then running npm install resolved this for me.

I might have found the solution.
Check on your directory tree if you have some pages / provider / etc that are not referenced in app.module. In my case, I still had the default pages/home folder, but I had deleted it from app.modules.ts
I am still investigating on another app, I'll give you further feedback.

I have the same problem, but only when I do
ionic cordova run android --prod

I downgraded angular to 4.4.4 from 5.0.0 and the error is gone when running with the --prod flag.

@bogomips can you be a little more specific or provide an example of what you mean here? I don't see anything wrong with my app.module.ts or main.ts.

@morrisonbrett I started to copy, 1 to 1, every single file from my project to a new one.
To a certain point (in the new project) I've got the error, it was generated from the pages/Home present on my src/ but never referenced on my app.modules (I had deleted it).
I did not finish the process yet, 'cause in the meanwhile I am cleaning and refactoring some code, I am switching to lettable operators in rxjs, etc, etc
Anyway, so far, I am compiling with --prod (in the new project) and everything works fine.
My feeling is the in the older project has some dead folder not actually used but that in someway they are taken in consideration from the compiler that searches for all .ts files.
I'll be sure of it as soon as I finish this process, but I will address you guy to this direction.
I hope I've been cleaner now.

I have the same issue, removing node_modules, package lock file and www build folder doesn't resolve for me the issue!

It could be we have some providers or something else which at the moment we don't have loaded in some module.
But it would be impossible find the file on hundreds and hundreds of files

Could be that, the only other thing when upgrading some of the ionic native stuff e.g splashScreen, statusBar, FileTransfer etc now needs to be imported into the providers in app.modules here's my package.json

    "dependencies": {
        "@angular/animations": "4.4.4",
        "@angular/common": "4.4.4",
        "@angular/compiler": "4.4.4",
        "@angular/compiler-cli": "4.4.4",
        "@angular/core": "4.4.4",
        "@angular/forms": "4.4.4",
        "@angular/http": "4.4.4",
        "@angular/platform-browser": "4.4.4",
        "@angular/platform-browser-dynamic": "4.4.4",
        "@ionic-native/barcode-scanner": "^4.2.1",
        "@ionic-native/core": "4.3.3",
        "@ionic-native/file": "4.3.3",
        "@ionic-native/file-transfer": "4.3.3",
        "@ionic-native/screenshot": "4.3.3",
        "@ionic-native/splash-screen": "4.3.3",
        "@ionic-native/status-bar": "4.3.3",
        "@ionic/storage": "2.0.1",
        "@types/es6-promise": "0.0.32",
        "@types/lodash": "^4.14.43",
        "angular2-highcharts": "^0.4.1",
        "angular2-notifications": "0.4.53",
        "chart.js": "^2.2.2",
        "cordova-ios": "^4.4.0",
        "cordova-plugin-add-swift-support": "^1.7.0",
        "cordova-plugin-compat": "^1.2.0",
        "cordova-plugin-device": "^1.1.6",
        "cordova-plugin-file": "^4.3.3",
        "cordova-plugin-file-transfer": "^1.6.3",
        "cordova-plugin-ionic": "^2.0.3",
        "cordova-plugin-printer": "~0.7.3",
        "cordova-plugin-splashscreen": "^4.0.3",
        "cordova-plugin-statusbar": "~2.2.0",
        "cordova-plugin-whitelist": "~1.3.0",
        "highcharts": "^5.0.6",
        "ionic": "^3.16.0",
        "ionic-angular": "^3.8.0",
        "ionicons": "3.0.0",
        "json-loader": "^0.5.4",
        "json2csv": "^3.7.3",
        "lodash": "^4.17.2",
        "reflect-metadata": "0.1.3",
        "rxjs": "^5.5.2",
        "sw-toolbox": "3.6.0",
        "zone.js": "0.8.18"
    },
    "devDependencies": {
        "@ionic/app-scripts": "^3.0.1",
        "@types/core-js": "^0.9.35",
        "@types/es6-shim": "^0.31.32",
        "@types/jasmine": "^2.5.41",
        "@types/node": "^6.0.52",
        "codelyzer": "^2.0.0-beta.3",
        "command-queue": "^0.1.4",
        "cordova": "^6.3.1",
        "del": "2.2.0",
        "eslint": "^3.4.0",
        "eslint-plugin-protractor": "^1.34.2",
        "execSync": "^1.0.2",
        "font-awesome": "^4.3.0",
        "jasmine-core": "^2.5.2",
        "jscs": "^3.0.7",
        "karma": "^1.3.0",
        "karma-chrome-launcher": "^2.0.0",
        "karma-cli": "^1.0.1",
        "karma-jasmine": "^1.1.0",
        "karma-mocha-reporter": "^2.2.1",
        "karma-phantomjs-launcher": "latest",
        "karma-remap-istanbul": "^0.2.2",
        "node-minify": "^1.3.9",
        "node-sass": "^3.9.3",
        "phantomjs-prebuilt": "latest",
        "protractor": "latest",
        "run-sequence": "1.1.5",
        "tslint": "^3.15.1",
        "tslint-eslint-rules": "^2.1.0",
        "tslint-ionic-rules": "0.0.5",
        "typescript": "2.4.2",
        "webpack-bundle-analyzer": "^1.5.3"
    },

Just upgraded today to 3.9.2 with the same issue.

I'm getting the error too upgrading to Angular 5 and running ionic build --prod. I also get the error using only ionic build --aot. On the plus side, these are running successfully:

  • ionic build --minifyjs
  • ionic build --minifycss
  • ionic build --optimizejs
  • ionic build --optimizejs --minifyjs --minifycss

Is --prod a short-form for --aot --optimizejs --minifyjs --minifycss, or does it give you something extra?

RE: @joeldavuk

...deleting node_modules and package-lock.json and the build folder for good measure, then running npm install resolved this for me.

I deleted all my project's repo contents (safe for _/.git/_) and did a git reset --hard to restore vanilla code. Also ensured _package-lock.json_ was deleted. Did an npm install and then ionic build --prod continued to fail with the same error.

RE: @bogomips

I started to copy, 1 to 1, every single file from my project to a new one ... Anyway, so far, I am compiling with --prod (in the new project) and everything works fine.

I inspected my _app.module.ts_ vs. the project file-system and didn't notice anything stale. Will keep an eye out, though.

_package.json_:

  "dependencies": {
    "@angular/common": "5.0.0",
    "@angular/compiler": "5.0.0",
    "@angular/compiler-cli": "5.0.0",
    "@angular/core": "5.0.0",
    "@angular/forms": "5.0.0",
    "@angular/http": "5.0.0",
    "@angular/platform-browser": "5.0.0",
    "@angular/platform-browser-dynamic": "5.0.0",
    "@ionic-native/core": "3.12.1",
    "@ionic-native/splash-screen": "3.12.1",
    "@ionic-native/status-bar": "3.12.1",
    "@ionic/storage": "2.1.3",
    "cordova-android": "^6.2.3",
    "cordova-plugin-console": "^1.0.5",
    "cordova-plugin-device": "^1.1.4",
    "cordova-plugin-splashscreen": "^4.0.3",
    "cordova-plugin-statusbar": "^2.2.2",
    "cordova-plugin-whitelist": "^1.3.1",
    "ionic-angular": "3.9.2",
    "ionic-plugin-keyboard": "^2.2.1",
    "ionicons": "3.0.0",
    "rxjs": "5.5.2",
    "sw-toolbox": "3.6.0",
    "zone.js": "0.8.18"
  },
  "devDependencies": {
    "@ionic/app-scripts": "^3.1.0",
    "typescript": "2.4.2"
  },

_ionic info_:

cli packages: (<somewhere>\node_modules)

    @ionic/cli-utils  : 1.18.0
    ionic (Ionic CLI) : 3.18.0

global packages:

    cordova (Cordova CLI) : 7.1.0

local packages:

    @ionic/app-scripts : 3.1.0
    Cordova Platforms  : android 6.4.0
    Ionic Framework    : ionic-angular 3.9.2

System:

    Android SDK Tools : 26.0.2
    Node              : v6.11.2
    npm               : 3.10.10
    OS                : Windows 10

Environment Variables:

    ANDROID_HOME : F:\android-sdk

Misc:

    backend : legacy

@matoos32 I am still in the process of copying/cleaning/refatoring on the new project, so far I keep compiling with --prod the new project. (not the old)

Does anyone have some code that this is happening with that they can share? Looking through all of this, I am certain this is not an Ionic Framework issue, though it could be an issue with @ionic/app-scripts, or possibly rxjs or Angular, or just with various projects and thus not an issue with any of the before mentioned at all, but if it is an issue with @ionic/app-scripts we would obviously want to fix it, so a sample application would be really helpful.

Also very interested to hear the results of @bogomips experiment.

@kensodemann I had problem for 2 days, but I just had to refactor rxjs. I am almost certain that people don't know how to do it. I spent today 6 hours refactoring code and made it work. I posted what I did here #2893

Thank-you @aces-tm! I am hoping that is the case for everyone and thus not actually an issue at all, but if there is an issue I want to make sure we get that fixed, so I think we will leave this open for a bit yet.

@kensodemann No problem. Honestly, when I read documentation how to upgrade to 3.9.0 I didn't pay too much attention to rxjs upgrade, but when I went back to read it again I realized that every http call must be adjusted to the new syntax so I am guessing that's the case with others... Here is a video that talks about refactoring rxjs youtube

i think aces-tm is right . just trying to do this . will let you know soon.

In my case as described in my bug on ionic/app-scripts the error is very randomized, it is also discussed by other one on the bug on angular. There are several bugs opened for angular compiler

Also after running in the bug also simple ionic cordova build anroid without --prod flag is not working.

Also removing www node_modules and package-lock.json and do it again does not work.

also simple ionic build is not working any more

On removing some files sometimes it works, but sometimes not, so it is difficult to reproduce the error, nearly inpossibile.

@aces-tm not sure if it is a problem of rxjs, we upgraded rxjs and think we have done it well, but the problem is still there. And sometimes it works and sometimes it does not work.
On the other side in your example you worte from every http call, are you using the olt HTTP or the new HTTPClient, you should use HTTPClient the other one is deprecated.

Hi,

I've been having this problem for 2 days. In my case, i try to create another new project and put my old file to the new project. I've done this 5 times and my conclusion is like @mburger81 's statement. "the error is very randomized". At 5 times the experiment, I copied all the files at once or one by one and the results are unpredictable.
Weird.

But I'm pretty sure the problem does matter something with the new RxJS 5.2. I thought we migrated well to new RxJS but for example new we run in the problem we used old finallyinstead of new finalize.

The problem is there was no error on ionic serve until now, but after removing some other files from project we run into this error on ionic serve. So in some case we have the error message on ionic serve and on other case not. But the finally was still there. After changing from finally to finalize we got no error message on ionic serve but the build still does not work. So perhaps there are other problems with rxjs but we get no errors on ionic serve, so at the end you can not trust into ionic serve for resolving the problem.

The next issue I ran into after this error was the RxJS library in particular this issue. https://github.com/angular/angular-cli/issues/7110 I had to update how it was imported, perhaps related?

The problem is for example I'm running this command to start with a complete fresh build
rm -R node_modules && rm -R www && rm package-lock.json && npm install && ionic cordova build android --prod --release
every thing is fine!
I copy by random one file, where RxJs doesn't matter, running the same command
rm -R node_modules && rm -R www && rm package-lock.json && npm install && ionic cordova build android --prod --release I get the error. Ok so now I remove the same file and run the same command the error is still there.

So for that reason I'm saying it is nearly not reproducible.

@joeldavuk Can you describe what do you intend with how it was imported, the linke issue is pretty long :)

For example I previously had

import {Observable} from "rxjs";
Observable.interval(2000)...

The operators now a required import and the import more specific

import {Observable} from "rxjs/Observable";
import 'rxjs/add/observable/interval';

i created a new project and started copy my files with plugins.
updated rxjs as per 5.5.2. project is working till now. but when ever i install "npm install ionic2-auto-complete --save" component. it is creating the given issue to me. " Can't resolve './app.module.ngfactory'"

@matoos32 update these ones to latest 4.4.0.may it could work for you .ionic-native/core ionic-native/splash-screen ionic-native/status-bar

@vksgautam1 yeah. Prod build is working after i've uninstalled ionic2-auto-complete and updated rxjs as per 5.5.2.

@ankit-makwana that is great.i have posted this issue in ionic2-auto-complete github issues forum . you can follow there to get it resolved

@vksgautam1 I have the same ionic2-auto-complete on my project, not yet ported on the new project (that compiles)
It would be interesting to understand what triggers the error since it would solve other people's problems too

ya agree . i am also digging in that.

@joeldavuk Ok this is one of many things you have to do, BTW you should it do in this way

import { interval } from 'rxjs/observable/interval';
interval(2000)

you don't have to use Observable and I think "add" is not used anymore

I think I got it, the problem is there are several errors, with always the same error message and ionic serve does work always correct which is the BIG problem

if you have a look on this
a) don't have components, providers or directives in project which are not included in a module
b) don't use *directives which are not imported in module, there is no error message for that
c) don't import Modules in project which are not available, no error message
d) refetor your rxjs to 5.5
e) check you lib if they are incompatible with ng5 most of the incompatibility is RxJS in ng5

Probably you think, all this point are for sure. But the big problem is most of the cases ionic serve run without error and in ionic build you have always the same error, so it is nearly impossible to find the errors, we take 2 days to discover all this errors.

All this errors can and can not be discovered by ionic serve, it depends on the combination of the errors. For example if there problems with directives the rxjs problems are not discovered.

I think I can reproduce this behavior also on an empty stupid new project

Wow.
It just went through fine, compiled with --prod.
I had 2 directives (folders) that weren't referenced in app.module and I also removed ./www.
Perhaps a combination of the two or the removal of ./www who knows.

Thanks all and @mburger81 for the summary!

@olivermuc do you mean you removed a ./www folder or the www folder itself?

We have too many open issues pertaining to this one issue. I am going to close this one (and others) and leave the following issue open: https://github.com/ionic-team/ionic-app-scripts/issues/1309

Reason: This particular issue list is for issues with the Ionic Framework itself. All of these issues so far seem to have two components:

  1. User code needs changing to match the correct way to do things with the newer libraries (mostly rxjs related, it seems)
  2. Code builds fine without --prod gives not exactly helpful error with --prod

The latter issue _may_ have something to do with Ionic tooling, but may also have more to do with tooling further down the chain. That is being investigated, but that is more closely related to @ionic/app-scripts which is why I am leaving that issue open.

This just consolidates things so we are not discussing the same issue in several different threads.

Please follow up with further info here: https://github.com/ionic-team/ionic-app-scripts/issues/1309

Correct, the www folder @ project root.
@richardshergold

finally , i my app run well .. as experience says error message doesn't get you in to right direction, ionic team still have to working on it.. in my case there was issue with cloudinary/angular-4.x
.. which still not supported angular 5 :)

In app.module.ts the line for Storage failed

providers: [
.......
    { provide: StorageProvider, useFactory: provideSettings, deps: [Storage] },
......
    { provide: ErrorHandler, useClass: IonicErrorHandler }
  ]

until I added 'Storage' along with StorageModule

import { IonicStorageModule, Storage } from '@ionic/storage';

For me also on non lazy loaded pages it is broken

Hi there,
For everyone running this issue take a look on Dan comment at https://github.com/ionic-team/ionic-app-scripts/issues/1309#issuecomment-343990321

This may help

Module not found: Error: Can't resolve './app.module.ngfactory' ionic-angular

this error also occurs when import an angular-ionic page which having module.ts file as sibling.
also do not import any ionic page which having @IonicPage() decorator.

In - app.module.ts

import {LoginPage} from '../pages/login/login'; //wrong #having a module.ts file as sibling in source tree

also don't add decorator as

@IonicPage() //wrong -- this is only for lazy loading
@Component({
selector: 'page-login',
templateUrl: 'login.html',
})
export class UserdashboardPage {}

component that are to be loaded as lazy so don't import them in app.module.ts

For me the answer was thiagosantos answer above: https://github.com/ionic-team/ionic/issues/13356#issuecomment-348154758

The ngc error alerted me to the fact that I had a copy of a .ts file lying around, resulting in an error: "Cannot determine the module for class xxxxxxxx".

@thiagosantos I actually had to downgrade from

"@ionic/app-scripts": "3.1.5",

to

"@ionic/app-scripts": "3.1.2",

But the real problem I had came from the aot which seems to be unable to link something from the UI to the controller (such as a private value used in the template). To find them (commit your changes first) run

./node_modules/.bin/ngc

Then

ionic cordova build android --prod

Will show all the possible code errors.

I also had as suggested @kensodemann to upgrade rxjs to 5.5.2 and change:

-import { Observable } from 'rxjs/Rx';
+import { Observable } from 'rxjs/Observable';

i downgraded angular from "5.0.0" to "4.4.4" it worked fine...just change the value of all angular dependencies in package.json and do npm install...hope it helps. Also make sure all pages you have are added to the Ng Module. Hack on!

In my case the problem was having a class in app.module without exporting it.

WRONG:
class LogErrorHandler implements ErrorHandler { ga: GoogleAnalytics; constructor() { this.ga = new GoogleAnalytics(); } handleError(error: any): void { const message = error.message ? error.message : error.toString(); this.ga.trackException(message, false); if (WL && WL.Logger && WL.Logger.error) { WL.Logger.error(message); } throw error; } }

GOOD:
export class LogErrorHandler implements ErrorHandler { ga: GoogleAnalytics; constructor() { this.ga = new GoogleAnalytics(); } handleError(error: any): void { const message = error.message ? error.message : error.toString(); this.ga.trackException(message, false); if (WL && WL.Logger && WL.Logger.error) { WL.Logger.error(message); } throw error; } }

Hi guys,

I had the same problem and this is how I resolve it:

  1. First, as you said, change all your RXJS imports from:
OLD: import { Observable } from 'rxjs/Rx';
GOOD: import { Observable } from 'rxjs/Observable';

OLD: import { Subscription } from 'rxjs/Rx;
GOOD: import { Subscription } from 'rxjs/Subscription';

(and so on)

  1. When you run --prod, the console doesn't give you the exact error. To solve it, run:
./node_modules/.bin/ngc

And you will get the real errors. Note that after update Ionic to the latest version (which uses the latest version of Angular), you have to be careful with private and public variable declarations. I had the same issue with Angular aswell.

The most common issues that I had was problems about private and public declarations, and also when use NGRX I cant export reducers using arrow functions, I've to use the functions in old way, I mean:

Instead of arrow function:

export const myreducer = () => {  return ...... }

I had to use:

export function myreducer() { return .....}

Once you have all your issues, run

ionic cordova run android --prod

And it should work. Hope it helps.

@bogomips
Thanks , me too face the same issue, and resolve be removing not used .ts(which were not imported app.module.ts) file from pages folder, issue resolved.
Thanks Once again.

Try run this command

$ ./node_modules/.bin/ngc

It will show the detail error part in your code, it saved my life trying to find what was causing the error. May this can help you.

I ran the ./bin/ngc command and was able to find the issue I was having. But now I have *.metadata.json and *ngsummary.json and other files created in my /src directory. Is there a command to remove them?

@drazmo Did you find an answer to your question yet? I also need to know if there is a command that will delete all the files that were generated on running ./node_modules/.bin/ngc . Please let me know if you find a solution to it.

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandyscarney picture brandyscarney  路  3Comments

alexbainbridge picture alexbainbridge  路  3Comments

manucorporat picture manucorporat  路  3Comments

SebastianGiro picture SebastianGiro  路  3Comments

danbucholtz picture danbucholtz  路  3Comments