--aot build error: ERROR in ./src/main.ts Module not found
See original GitHub issueIssue Description
$ng serve with build param --aot has error:
ERROR in ./src/main.ts Module not found ...
However, build is successful using plain ng serve or ng serve --prod.
OS?
Mac OSX Sierra
Versions.
angular-cli: 1.0.0-beta.26 node: 7.2.1 os: darwin x64 @angular/common: 2.4.4 @angular/compiler: 2.4.4 @angular/core: 2.4.4 @angular/forms: 2.4.4 @angular/http: 2.4.4 @angular/platform-browser: 2.4.4 @angular/platform-browser-dynamic: 2.4.4 @angular/router: 3.4.4 @angular/compiler-cli: 2.4.4
Repro steps.
N.A. default Angular-cli
The log given by the failure.
ERROR in ./src/main.ts
Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/Users/home/Desktop/web_2/Dev/00_Active_Dev/src'
@ ./src/main.ts 4:0-74
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts
ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js
Module not found: Error: Can't resolve '/Users/home/Desktop/web_2/Dev/00_Active_Dev/src/$$_gendir' in '/Users/home/Desktop/web_2/Dev/00_Active_Dev/node_modules/@angular/core/src/linker'
@ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 71:15-36 87:15-102
@ ./~/@angular/core/src/linker.js
@ ./~/@angular/core/src/core.js
@ ./~/@angular/core/index.js
@ ./src/main.ts
@ multi webpack-dev-server/client?http://localhost:4200/ ./src/main.ts
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:7 (2 by maintainers)
Top Results From Across the Web
2 Answers - 2 - Stack Overflow
Angular 4 error - ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory'.
Read more >MDB Angular Pro - 4.3.1 does not build in the -prod mode
4 - Forth run of ng build -prod brings CLI error: ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in ...
Read more >Can't build my project : r/Angular2 - Reddit
If I try to run ng build --prod or ng build --aot, ... src/app/app.module.ts Module not found: Error: Can't resolve '../. ... src/main.ts....
Read more >Angular 6 AOT build fails on Kendo UI Angular modules - Telerik
ERROR in ./src/app/foo/bar/bar. · Module not found: Error: Can't resolve '@package-author/package. · resolve '@package-author/package. · Parsed ...
Read more >field 'browser' doesn't contain a valid alias configuration angular
assets/app/main.aot.ts' }, output: { path: path.resolve(__dirname + ... src/app/employee/employee.component.ts Module not found: Error: Can't resolve '.
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
If you can provide us with a repo we can look at, we might be able to help. The error by itself doesn’t tell me much though.
Ok. I got the solutions please restart your app. if you delete any existing module in your app.