$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.
Mac OSX Sierra
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
N.A. default Angular-cli
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
Can you please provide the source for the app module? Or even better a small project that shows this problem happening?
Also, do you have the same issue if you use NPM 6.x?
Thanks a lot.
Just finished fixing one of these...In my case, someone had copied one component to another folder (in a different module). So, I've ended with:
/drivers/driver.component.ts (included in driver.module.ts)
...
/user/driver.component.ts (no included in any module)~
Interestingly, the error msg said that /drivers/driver.component.ts wasn't associated to any module (instead of /user/drivers,component.ts)...
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.
I have deleted my existing module from angular js 2 then it will be raise this kind of error.
Ok. I got the solutions please restart your app. if you delete any existing module in your app.
Thank you for your wonderful responses and fixes.
In NG4 beta+ && Node 7+. aot runs splendidly including lazily-loaded modules. The performance is phenomenal (see below for versions used). Can't image how much better it can get when I top it up with Service workers and Universal.
@angular/cli: 1.0.0-beta.31 (NG4 is going into RC4 as of writing)
node: 7.4.0
os: darwin x64
@angular/common: 4.0.0-beta.7
@angular/compiler: 4.0.0-beta.7
@angular/core: 4.0.0-beta.7
@angular/forms: 4.0.0-beta.7
@angular/http: 4.0.0-beta.7
@angular/material: 2.0.0-beta.2
@angular/platform-browser: 4.0.0-beta.7
@angular/platform-browser-dynamic: 4.0.0-beta.7
@angular/router: 4.0.0-beta.7
@angular/cli: 1.0.0-beta.31
@angular/compiler-cli: 4.0.0-beta.7
This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.
Read more about our automatic conversation locking policy.
_This action has been performed automatically by a bot._
Most helpful comment
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.