[AOT] @ngtools/webpack throws "Cannot find module './ngfactory/app/app.module.ngfactory'"
See original GitHub issueOS?
Windows_NT 10.0.10586
Description.
I’m trying to integrate @ngtools/webpack
into my custom webpack build and is getting Cannot find module './ngfactory/app/app.module.ngfactory'
error. The source of the error is here. I’ve managed to suppress the error by disabling this check.
Repro steps.
Github repo: https://github.com/DzmitryShylovich/ngtools-error
npm i
npm start
The log given by the failure.
ERROR in ./app/main.aot.ts
Module build failed: Error: D:/Workspace/ngtools-error/app/main.aot.ts (3,34): Cannot find module './ngfactory/app/app.module.ngfactory'.)
at _transpile (D:\Workspace\ngtools-error\node_modules\@ngtools\webpack\src\loader.js:101:19)
at D:\Workspace\ngtools-error\node_modules\@ngtools\webpack\src\loader.js:125:26
Issue Analytics
- State:
- Created 7 years ago
- Reactions:16
- Comments:19 (4 by maintainers)
Top Results From Across the Web
1
I'm trying to integrate AOT in my project angular project. it throws the error when running the project. GET http://localhost:3000/aot/app/app.
Read more >angular/angular - Gitter
module have declared 'Landlord module'. Redirect appears when i refresh in landlord/help (child component). In addition my Landlord module have ...
Read more >Switching from angular2-template-loader to @ngtools ...
Module not found: Error: Can't resolve './main.ts.ngfactory' in '/path/to/application/directory'. Another strange problem that I don't ...
Read more >how should I generate the app.module.ngfactory.ts file?
I'm trying to get my ng2 app set up for AOT. It seems that an app.module.ngfactory.ts file is needed for this instead of...
Read more >module not found: error: can't resolve '@angular/localize/init'
I get an exception throw Module not found: Error: Cant resolve ... Here is how you can do it: @Component ( { selector:...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Anyone still getting this?
When you run the ng build in angular 2, latest angular-cli automatically runs with --aot parameter (ahead of time compilation), so it is trying to optimize your code. You are having a package that is not yet compatible for optimizing. So you need update to your packages. Most probably the packages that has forRoot() in your app.module.ts
I recommend to update all packages.
Easy way to update your package is to the use package below, which i got it from http://stackoverflow.com/questions/36597780/how-do-i-correctly-upgrade-angular-2-npm-to-the-latest-version
Install
npm install -g npm-check-updates
Usage
ncu
for displayncu -u
for re-writing your package.jsonand run
npm install
to update your packages