-
Notifications
You must be signed in to change notification settings - Fork 311
Error: ./src/app/main.ts Module not found: Error: Can't resolve './app.module.ngfactory' in 'C:\Users\Joish\Documents\angular\gait\src\app' #1317
Comments
Did you try |
could you be more specific...? |
+1 I'm dealing with the same problem. I've been stucked for a week with this and still can't find a solution. Everything works ok when I run but when I run i get the following error: What i found strange is that I started a new ionic app with However, when I started a new app with the "super" template, without doing any modification in the code, I got the same error output when trying to run with --prod flag. Does anyone know how can I overcome this? Thanks in advance |
Use ./node_modules/.bin/ngc to figure out your error. This is a workaround which let you survive in meantime. |
I did not use --prod or --release flag, and it worked for me, now I do not know what problems I may have in the future |
@jdhades Exactly,when I don't use --prod it works completely fine......I have no idea why this error occurs |
If you're having troubles with the "super" template, take a look at this. |
Use ./node_modules/.bin/ngc to figure out your error. The problem is for lazy loading pages... when you create a page it generates the file module.ts, the solution that worked for me was to delete the files module.ts (ex: module.test.ts) and remove @IonicPage() from test.ts Edit: this happens when you declare the pages in the app.module.ts, at less you use lazy loading it is not necessary to declare it in the app.module.ts Regards |
Thanks @george19gt that was useful. Pretty annoying that the real error is nowhere to be found when building with --prod. |
This is fixed in Thanks, |
Thanks @flakolefluk |
Thanks everyone......... |
In my case, I updated @ionic/app-scripts to version 3.1.4 and works perfectly. (cmd)on windows: |
I have no idea what's going wrong...?
can any of u help
C:\Users\Joish\Documents\angular\gait>ionic cordova build android --prod --release
Running app-scripts build: --prod --platform android --target cordova
[14:07:31] build prod started ...
[14:07:31] clean started ...
[14:07:31] clean finished in 4 ms
[14:07:31] copy started ...
[14:07:32] deeplinks started ...
[14:07:32] deeplinks finished in 38 ms
[14:07:32] ngc started ...
[14:07:37] ngc finished in 5.49 s
[14:07:37] preprocess started ...
[14:07:37] preprocess finished in 1 ms
[14:07:37] webpack started ...
[14:07:37] copy finished in 5.84 s
Error: ./src/app/main.ts
Module not found: Error: Can't resolve './app.module.ngfactory' in 'C:\Users\Joish\Documents\angular\gait\src\app'
resolve './app.module.ngfactory' in 'C:\Users\Joish\Documents\angular\gait\src\app'
using description file: C:\Users\Joish\Documents\angular\gait\package.json (relative path: ./src/app)
Field 'browser' doesn't contain a valid alias configuration
after using description file: C:\Users\Joish\Documents\angular\gait\package.json (relative path: ./src/app)
using description file: C:\Users\Joish\Documents\angular\gait\package.json (relative path: ./src/app/app.module.ngfactory)
no extension
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Joish\Documents\angular\gait\src\app\app.module.ngfactory doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Joish\Documents\angular\gait\src\app\app.module.ngfactory.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Joish\Documents\angular\gait\src\app\app.module.ngfactory.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
C:\Users\Joish\Documents\angular\gait\src\app\app.module.ngfactory.json doesn't exist
as directory
C:\Users\Joish\Documents\angular\gait\src\app\app.module.ngfactory doesn't exist
[C:\Users\Joish\Documents\angular\gait\src\app\app.module.ngfactory]
[C:\Users\Joish\Documents\angular\gait\src\app\app.module.ngfactory.ts]
[C:\Users\Joish\Documents\angular\gait\src\app\app.module.ngfactory.js]
[C:\Users\Joish\Documents\angular\gait\src\app\app.module.ngfactory.json]
[C:\Users\Joish\Documents\angular\gait\src\app\app.module.ngfactory]
@ ./src/app/main.ts 2:0-60
at BuildError.Error (native)
at new BuildError (C:\Users\Joish\Documents\angular\gait\node_modules@ionic\app-scripts\dist\util\errors.js:16:28)
at callback (C:\Users\Joish\Documents\angular\gait\node_modules@ionic\app-scripts\dist\webpack.js:121:28)
at emitRecords.err (C:\Users\Joish\Documents\angular\gait\node_modules\webpack\lib\Compiler.js:269:13)
at Compiler.emitRecords (C:\Users\Joish\Documents\angular\gait\node_modules\webpack\lib\Compiler.js:375:38)
at emitAssets.err (C:\Users\Joish\Documents\angular\gait\node_modules\webpack\lib\Compiler.js:262:10)
at applyPluginsAsyncSeries1.err (C:\Users\Joish\Documents\angular\gait\node_modules\webpack\lib\Compiler.js:368:12)
at next (C:\Users\Joish\Documents\angular\gait\node_modules\tapable\lib\Tapable.js:218:11)
at Compiler.compiler.plugin (C:\Users\Joish\Documents\angular\gait\node_modules\webpack\lib\performance\SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (C:\Users\Joish\Documents\angular\gait\node_modules\tapable\lib\Tapable.js:222:13)
The text was updated successfully, but these errors were encountered: