-
Notifications
You must be signed in to change notification settings - Fork 311
Can't resolve './app.module.ngfactory' on --prod build and ng5 #1309
Comments
FYI: there are other to open issues on ionic-angular and angular |
Have the same issue, ngc is not generating the ngfactory.js files. |
I spent entire hours to understand the issue !! |
Same here!! |
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 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 |
@mburger81 - @danbucholtz is currently working on this issue using the repo of a fellow Ionic employee that has the same issues. However, if you do duplicate this with a minimal project please post a link here. That may turn out to be very helpful. |
All, I am working with the angular team on resolving this issue. The
In the meantime, to see the errors in your application and fix them, try running:
This should report any errors you have. If you don't have any errors and your application still doesn't work correctly, please let me know. Thanks, |
@danbucholtz Great! $ ./node_modules/.bin/ngc
Thanks! |
@bogomips so do you intend ionic components are ng5 incompotible? |
This is fixed in Thanks, |
Confirmed fixed. Thank you @danbucholtz |
I can confirm I'm now seeing errors in .html files when running |
@danbucholtz for me the error persists. @ionic/[email protected] does not resolve the issue for me. |
Different Error, still cryptic $ rm -rf www/ node_modules/ && npm install && npm run ionic:build -- --prod
While ngc gives a human error: $ ./node_modules/.bin/ngc
|
For me version |
Thanks @danbucholtz I have been having these issues as well (when doing a --prod build) - upgrading to @3.1.2 got rid of the error I was getting and I also cleared the html errors I was seeing when I ran
However, when I do a --prod build now I get the following error:
Ionic Info:
|
Try to increase the memory fore node : |
Thanks for correcting the problem. |
@danbucholtz and @kensodemann After that I remove the I created a repo to help you: On running On running ionic
This is my environment:
Edit: |
The new ionic scripts now gives a better error description. I've tracked the error to my declaration of a component in app.module.ts where I made a typo when importing like so:
where I added the .ts file extension to the end, and it lingered there for God knows when and didn't trow any compile errors. Removing the .ts extension fixed the problem. |
In my case, I updated |
Now working for me too. Thanks. |
I solved it with version 3.1.1 |
Hi, I have installed @ionic/app-scripts on 3.1.2 and the error to be continued. `cli packages: (C:\Users\Vinicius\AppData\Roaming\npm\node_modules)
global packages:
local packages:
System:
Environment Variables:
Misc:
########################### I run npm install many times, but this error persists. THE ERRO WHEN I RAN: ionic cordova build android --release --prod
|
Did you run cmd As suggested. It gives a better error description |
Got this error when I followed a tutorial for Ionic. cli packages: Create a new project with super template and build for android with --prod ionic start myNewSuperProject super Error: Run: |
Hello to everyone. Here I found the hack to fix my Ionic configuration. https://github.com/ionic-team/ionic/blob/master/CHANGELOG.md#390-2017-11-08 |
@radix21 |
I opened a new bug for this #1315 |
@danbucholtz Hi, Dan, in your post above you said you are working with the angular team, and suggest running
to see what the errors are. In my case, I'm starting with a fresh project based on AngularFire 5.3. I've followed their docs,
except I'm using lazy loading. So the "home" page is missing, and there's a login page instead. Also, I include ngx-charts.
Is this an error in AngularFire????? I've posted a git repo with my code:
Project builds and runs fine without the --prod flag.
|
I SOLVED MY PROBLEM WITH NEXT STEPS I have one App in IONIC 2, and I was update to Ionic 3. Because of this, i get the related erros above. After testing many steps like without success (remove node_modules, remove package.json, run npm install), I get success with this:
|
ionic/app-scripts: "3.1.2" the same error |
Had same error. Ran After deleting that unused and unneeded directive, everything now build fine with If a directive, component, etc not being referenced anywhere in the code is going to cause aot errors, it would be nice if the tooling could run ngc for us in the background to give a helpful error. It would save hours of research in some cases. |
They are already running ngc, have a look at log. But they don't show the right error (or somethingblike that) . Really don't know why they don't care anymore about it very.... |
Finally get rid of this error You will need to run No need to downgrade hopefully. In my case I just used some function in my component decorator. That is fully javascript-acceptable, but ngc dislike it
translationX was a function for factoring some code, nothing wrong or important neither |
Running: Outputs:
While running
And yes, this is the error in my case: RouterModule.forRoot([
{
path: AppRoutingRouteNames.Dashboard,
loadChildren: () => DashboardModule
}
]) Which can be solved like this (btw): export function myModuleEntryPoint() {
return MyModule;
}
RouterModule.forRoot([
{
path: AppRoutingRouteNames.Dashboard,
loadChildren: dashboardModuleEntryPoint
}
]) The default command does not lead me to the correct error. |
This is resolved in Thanks, |
@danbucholtz not resolved in my case, sorry, though the error still appears to be with
which gives the same error as before
As I mentioned in my earlier post, this might be an angularfire bug; however, you mentioned you interface with that team. The error from
is as before:
Would love whatever clues you might have on how to patch this!
|
Hi there, I get this error while running command Any suggestions to solve this.
`cli packages: (/home/venkat/.nvm/versions/node/v8.7.0/lib/node_modules)
global packages:
local packages:
System:
Environment Variables:
Misc:
|
Hi @kotrakrishna
comand ./node_modules/.bin/ngc
anyone have solution, please help? |
@drakgit How is your tsconfig.json looking? The error says, the field experimentalDecorators is missing. This is mine tsconfig.json: {
"compilerOptions": {
"allowSyntheticDefaultImports": true,
"declaration": false,
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"alwaysStrict": true,
"noImplicitAny": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"lib": [
"es2015",
"dom"
],
"typeRoots": [
"./node_modules/@types"
],
"module": "commonjs",
"moduleResolution": "node",
"sourceMap": true,
"target": "es5"
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules"
],
"compileOnSave": false,
"atom": {
"rewriteTsconfig": false
}
} |
Hi StefanRein
|
This is resolved for me in "ionic/app-scripts": "3.1.7" |
Updating to latest ionic/app-scripts version gave a better error message. |
Hi guys In my case, I updated @ionic/app-scripts to version 3.1.2 and works perfectly. |
I updated my project to In my case the problem was that some individual pages (views) in my app included module declaration in their respective folders, but they were also declared in the AppModule, so there was a duplicate declaration. |
The mvp comment of this issue thread is the best possible way to tackle this issue. For me, particularly, after I ran ngc compile on the whole project, the compiler screamed at me for passing parameters from html to functions and not expecting them on the functional parameters. It's a code mishap that got pass tsc but ultimately failed at aot compiler. That being said, I have one more issue. When I run node_modules/.bin/ngc, it creates a lot of metadata, ngsummary, ngfactory and js/js.map files side by side with my actual .ts files. If I remove all of those then I go back to square one and see the issue the original poster mentioned. How do I tackle this issue of seeing 50 extra files (metadata/ngfactory/ngsummary) side by side with my actual .ts files? |
Try run this command
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. |
Remove filename.module.ts from newly created page, its work for me |
Short description of the problem:
Updating to ionic3.9 and ng5 on doing a production build with
ionic cordova build android --prod --release
I get this error
What behavior are you expecting?
I was not able to check which could be the problem, I'm able to reproduce the error on a new build copying my production files. The problem is, sometime I can remove a file and the build works, sometimes it does also not work on removing the same file, in this case I have to remove an other random file to get it work again.
So there is no logic on which file to remove to get it work again.
So at the end, I can not reproduce the error!
Which @ionic/app-scripts version are you using?
The text was updated successfully, but these errors were encountered: