Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AoT not working! #340

Closed
taras-samkvoskyi opened this issue Jul 24, 2017 · 9 comments
Closed

AoT not working! #340

taras-samkvoskyi opened this issue Jul 24, 2017 · 9 comments

Comments

@taras-samkvoskyi
Copy link

taras-samkvoskyi commented Jul 24, 2017

Hey Mark,

AoT compilation stopped working. Now I'm receiving this error when running webpack:
ERROR in ./Client/main.browser.ts Module not found: Error: Can't resolve './$$_gendir/app/browser-app.module.ngfactory' in '\aspnetcore-angular2-universal-master\Client' @ ./Client/main.browser.ts 3:0-89
Could you help me with it?

@MarkPieszak
Copy link
Member

Is this from a fresh project ? Or after adding some components / etc.
What errors come up when you do npm run build:AoT it should give some info on where it failed.

@taras-samkvoskyi
Copy link
Author

taras-samkvoskyi commented Jul 25, 2017

It's on fresh project.
npm run build:AoT fails with

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! angular4-aspnetcore-universal@1.0.0-rc3 build:aot: `webpack --env.aot --env.client & webpack --env.aot --env.server`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the angular4-aspnetcore-universal@1.0.0-rc3 build:aot script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     AppData\Roaming\npm-cache\_logs\2017-07-25T06_35_05_136Z-debug.log

And in build log I have those errors

ERROR in ./Client/main.browser.ts
    Module not found: Error: Can't resolve './$$_gendir/app/browser-app.module.ngfactory' in '..\aspnetcore-angular2-universal-master\Client'
     @ ./Client/main.browser.ts 3:0-89
ERROR in ./Client/$$_gendir lazy
Module not found: Error: Can't resolve '..\aspnetcore-angular2-universal-master\Client\$$_gendir\app\containers\+lazy\lazy.module.ngfactory.ts' in '..\aspnetcore-angular2-universal-master\Client\$$_gendir'
 @ ./Client/$$_gendir lazy
 @ ./~/@angular/core/@angular/core.es5.js
 @ ./Client/main.browser.ts`

@MarkPieszak
Copy link
Member

Do you have aspnetcore environment set to production when trying to do AoT builds?
Also what version of node and npm are you using?

@taras-samkvoskyi
Copy link
Author

Yes it was.
Node v8.0.0 npm - 5.0.3.
I found similar problem here angular/angular-cli#7125.
Adding enhanced-resolve: 3.3.0 helped me.

@TommyKolodziejczyk
Copy link

enhanced-resolve: 3.3.0 helped me as well,

the error was on clean clone also on automatic build on visualstudio.vom (2017 hosted)

@markoj21
Copy link
Contributor

markoj21 commented Jul 25, 2017

The issue was introduced with enhanced-resolved that is used by @ngtools/webpack as a dependency by ngtools/webpack.
Updating the @ ngtools/webpack: "1.5.3" fixed the issue as they released an emergency fix freezing the internal dependency to enhanced-resolved@3.3.0.

More details are here webpack/enhanced-resolve#98

@borgotecnologia
Copy link

I have the same issue:
I updated all packages to the most recent, but, the error that I have is:

ERROR in ./Client/main.browser.ts
Module not found: Error: Can't resolve './$$_gendir/app/browser-app.module.ngfactory' in 'S:\EMPREGOS\Core\Universal_Bacon\Angular_File_by_File\Cli
ent'
@ ./Client/main.browser.ts 3:0-89

and:

ERROR in ./Client/main.server.aot.ts
Module not found: Error: Can't resolve './ngfactory/app/server-app.module.ngfactory' in 'S:\EMPREGOS\Core\Universal_Bacon\Angular_File_by_File\Clie
nt'
@ ./Client/main.server.aot.ts 6:0-87

and:

npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! empregos@0.0.2 build:aot: webpack --env.aot --env.client & webpack --env.aot --env.server
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the empregos@0.0.2 build:aot script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\daniel.cb\AppData\Roaming\npm-cache_logs\2017-07-25T20_36_49_570Z-debug.log

I send you a copy of my project. Could you see if is a framework problem or package version problem?

Angular_File_by_File.zip

@Crazyht
Copy link

Crazyht commented Jul 27, 2017

Hi,

try add "enhanced-resolved" : "3.3.0" to devDependencies, normaly this package fix the problem.

Note: On computer with npm5 the error still with this fix :( I don't have found how to fix with npm 5

@MarkPieszak
Copy link
Member

MarkPieszak commented Aug 19, 2017

This will be cleaned up in the latest PR #376

@Samkovskyi

But all you need to do is remove include: /Client from your .ts$ module rules in webpack.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants