Cannot find module "./app.module.ngfactory"

Good Day!

Can someone please help me about this:

I run my app on device using command ionic run android and no error shows.
In my device it display white screen only then in console found this error:

I tried to search, and apply their suggestions like try to remove .tmp and node_modules and reinstall it again…but still getting this.

System info:
image

Thanks.

I have the same issue when I run ionic build then it throws error:

.tmp/app/main.prod.ts:4:36
[00:26:58] Cannot find module ‘./app.module.ngfactory’.
[00:26:58] ngc failed
[00:26:58] ionic-app-script task: “build”
[00:26:58] Error: Error

There is no app.module.ngfactory generated

Hi @crash21 , Did you solve the error?
I solved mine by ::

  • removing: .tmp, node_modules, www
  • update my package.json
  • then run the following command ::
    npm install
    ionic build android
    ionic run android

This links maybe can help you also:

Which version of Typescript are you using? Latest version (2.1.x) is not yet compatible with Angular/Ionic. For me this was causing the error.

2 Likes

thanks @Gunnaway , this solved my problem.
I just fixed the version to 2.0.10 and it works fine again :slight_smile:

1 Like

I tried again doing the steps you told me but no luck still happening.

Hi @crash21 how about try to run this command:
npm install @ionic/app-scripts@latest

I did no luck :frowning: Really wierd…
Btw in my package.json dependencies I have:

“devDependencies”: {
@ionic/app-scripts”: “latest”,
“typescript”: “^2.0.9”
},

So they were already in latest version

Can you please show your ionic info?

Your system information:

Cordova CLI: 6.4.0
Ionic Framework Version: 2.0.0-rc.3
Ionic CLI Version: 2.1.0-beta.3
Ionic App Lib Version: 2.1.0-beta.1
OS:
Node Version: v6.9.2

It works for me:

npm install
npm install @ionic/app-scripts@latest
cordova platform add android@6.1.0
ionic build android
ionic run android