Skip to content

--aot build error: ERROR in ./src/main.ts Module not found #4239

@pageii

Description

@pageii

Issue 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    needs: repro stepsWe cannot reproduce the issue with the information given

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions