Build error Module not found: Error: Can't resolve './app.module.ngfactory'

Hi,

Sorry if this have been posted before. I searched and did not find anything that helped.

However I have migrated from Legacy to Pro and with a little fiddle I managed to push my code to my Ionic git repository and ionicjs started building my app.

I ran into an issue with the build with this error: [16:54:07] Error: ./src/app/main.ts Module not found: Error: Can’t resolve ‘./app.module.ngfactory’…

Here is the full build log error:


[16:54:07] Error: ./src/app/main.ts Module not found: Error: Can’t resolve ‘./app.module.ngfactory’ in ‘/usr/src/app/src/app’ resolve ‘./app.module.ngfactory’ in ‘/usr/src/app/src/app’ using description file: /usr/src/app/package.json (relative path: ./src/app) Field ‘browser’ doesn’t contain a valid alias configuration after using description file: /usr/src/app/package.json (relative path: ./src/app) using description file: /usr/src/app/package.json (relative path: ./src/app/app.module.ngfactory) no extension Field ‘browser’ doesn’t contain a valid alias configuration /usr/src/app/src/app/app.module.ngfactory doesn’t exist .ts Field ‘browser’ doesn’t contain a valid alias configuration /usr/src/app/src/app/app.module.ngfactory.ts doesn’t exist .js Field ‘browser’ doesn’t contain a valid alias configuration /usr/src/app/src/app/app.module.ngfactory.js doesn’t exist .json Field ‘browser’ doesn’t contain a valid alias configuration /usr/src/app/src/app/app.module.ngfactory.json doesn’t exist as directory /usr/src/app/src/app/app.module.ngfactory doesn’t exist [/usr/src/app/src/app/app.module.ngfactory] [/usr/src/app/src/app/app.module.ngfactory.ts] [/usr/src/app/src/app/app.module.ngfactory.js] [/usr/src/app/src/app/app.module.ngfactory.json] [/usr/src/app/src/app/app.module.ngfactory] @ ./src/app/main.ts 2:0-60 Error: ./src/app/main.ts Module not found: Error: Can’t resolve ‘./app.module.ngfactory’ in ‘/usr/src/app/src/app’ resolve ‘./app.module.ngfactory’ in ‘/usr/src/app/src/app’ using description file: /usr/src/app/package.json (relative path: ./src/app) Field ‘browser’ doesn’t contain a valid alias configuration after using description file: /usr/src/app/package.json (relative path: ./src/app) using description file: /usr/src/app/package.json (relative path: ./src/app/app.module.ngfactory) no extension Field ‘browser’ doesn’t contain a valid alias configuration /usr/src/app/src/app/app.module.ngfactory doesn’t exist .ts Field ‘browser’ doesn’t contain a valid alias configuration /usr/src/app/src/app/app.module.ngfactory.ts doesn’t exist .js Field ‘browser’ doesn’t contain a valid alias configuration /usr/src/app/src/app/app.module.ngfactory.js doesn’t exist .json Field ‘browser’ doesn’t contain a valid alias configuration /usr/src/app/src/app/app.module.ngfactory.json doesn’t exist as directory /usr/src/app/src/app/app.module.ngfactory doesn’t exist [/usr/src/app/src/app/app.module.ngfactory] [/usr/src/app/src/app/app.module.ngfactory.ts] [/usr/src/app/src/app/app.module.ngfactory.js] [/usr/src/app/src/app/app.module.ngfactory.json] [/usr/src/app/src/app/app.module.ngfactory] @ ./src/app/main.ts 2:0-60 at new BuildError (/usr/src/app/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28) at callback (/usr/src/app/node_modules/@ionic/app-scripts/dist/webpack.js:121:28) at emitRecords.err (/usr/src/app/node_modules/webpack/lib/Compiler.js:265:13) at Compiler.emitRecords (/usr/src/app/node_modules/webpack/lib/Compiler.js:371:38) at emitAssets.err (/usr/src/app/node_modules/webpack/lib/Compiler.js:258:10) at applyPluginsAsyncSeries1.err (/usr/src/app/node_modules/webpack/lib/Compiler.js:364:12) at next (/usr/src/app/node_modules/tapable/lib/Tapable.js:218:11) at Compiler.compiler.plugin (/usr/src/app/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4) at Compiler.applyPluginsAsyncSeries1 (/usr/src/app/node_modules/tapable/lib/Tapable.js:222:13) at Compiler.afterEmit (/usr/src/app/node_modules/webpack/lib/Compiler.js:361:9) npm info lifecycle Pronto@0.0.1~build: Failed to exec build script npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! Pronto@0.0.1 build: ionic-app-scripts build --prod npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the Pronto@0.0.1 build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

I searched online for what it might be and what I have understood by now is that this is a general error for something else (?). I have tried most things in this thread: https://github.com/ionic-team/ionic/issues/13356 without luck.

My Ionic info is as following:

cli packages: (C:\Users\damor\AppData\Roaming\npm\node_modules)

@ionic/cli-utils  : 1.19.0
ionic (Ionic CLI) : 3.19.0

global packages:

cordova (Cordova CLI) : 7.1.0

local packages:

@ionic/app-scripts : 3.1.0
Cordova Platforms  : android 6.3.0 ios 4.5.4
Ionic Framework    : ionic-angular 3.9.2

System:

Node : v8.9.1
npm  : 5.5.1
OS   : Windows 10

Environment Variables:

ANDROID_HOME : not set

Misc:

backend : pro

I get the same error in my CLI when I run “ionic cordova build android --prod”.

When I run ./node_modules/.bin/ngc I get this message:

F:\SkyDrive\Ionic\Pronto\node_modules.bin>ngc
error TS18003: No inputs were found in config file ‘tsconfig.json’. Specified ‘include’ paths were ‘["**/*"]’ and ‘exclude’ paths were ‘[“node_modules”,“bower_components”,“jspm_packages”]’.

Have google it and tried things that have been suggested without luck.

I am running out of ideas.

Anyone have any ideas I can try?

Best Regards
Ionic/Angular/TS/Everything Noob
Joachim Strand

Hi,

did you find a solution to this problem?