Skip to content

AoT ERROR in Cannot read property 'codeGen' of undefined #3682

@aaronleestic

Description

@aaronleestic

OS?

OSX El Capitan, OSX Sierra, Amazon Linux on EC2

Versions.

beta.22 / angular 2.2.3

Repro steps.

I have a branch cut from a few weeks ago on the above versions.
Several days ago, ng build --aot=true --target=production works fine.
Yesterday, same command fails (log below)

Keep in mind that this is via a build server on Jenkins, which checks out a clean copy every time. To replicate, I did a clean checkout of my repo in another directory, switch to the cut branch that hasn't been modified since our last sprint, and the same issue appears.

I was able to build fine on my local workspace repo, but once I deleted my cached node_module directory and re-installed all dependencies, I get the same error below.

The log given by the failure.

Hash: 298b4d5b0927ce483a6d Time: 18425ms chunk {0} scripts.2ec7b6c32f2cecb6ef43.bundle.js, scripts.2ec7b6c32f2cecb6ef43.bundle.map (scripts) 112 kB {4} [initial] [rendered] chunk {1} main.0ffb0f0b246299e375b6.bundle.js, main.0ffb0f0b246299e375b6.bundle.map (main) 2.02 kB {3} [initial] [rendered] chunk {2} styles.b2328beb0372c051d06d.bundle.js, styles.fc27ae193c6cf276eb76015a2f77056b.bundle.css, styles.b2328beb0372c051d06d.bundle.map, styles.b2328beb0372c051d06d.bundle.map (styles) 69 bytes {4} [initial] [rendered] chunk {3} vendor.0c6af147dfcf8a75bb37.bundle.js, vendor.0c6af147dfcf8a75bb37.bundle.map (vendor) 855 kB [initial] [rendered] chunk {4} inline.d41d8cd98f00b204e980.bundle.js, inline.d41d8cd98f00b204e980.bundle.map (inline) 0 bytes [entry] [rendered]

ERROR in Cannot read property 'codeGen' of undefined

ERROR in ./src/main.ts Module not found: Error: Can't resolve './$$_gendir/app/app.module.ngfactory' in '/Users/aaron/repos/my-clean-checkout/src' @ ./src/main.ts 4:0-74 @ multi main

ERROR in ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js Module not found: Error: Can't resolve '/Users/aaron/repos/my-clean-checkout/src/$$_gendir' in '/Users/aaron/repos/my-clean-checkout/node_modules/@angular/core/src/linker' @ ./~/@angular/core/src/linker/system_js_ng_module_factory_loader.js 46:15-36 58:15-102 @ ./~/@angular/core/src/linker.js @ ./~/@angular/core/src/core.js @ ./~/@angular/core/index.js @ ./src/main.ts @ multi main

Mention any other details that might be useful.

I suspect some breaking bug might have been published to beta.22, angular 2.2.3, or one of its dependencies. NPM is fetching the same version from the public repo as before, but getting a bad version now.

Upgrading to beta.24 / angular 2.3.0+ may not be a feasible solution since I use a few libraries that hasn't been exported to be AoT compatible for 2.3.0+, but instead still works for 2.2.3. If I were to upgrade, I get the error reported at #3674

##UPDATE the internal dependency in question appears to be "@ngtools/webpack". Perhaps the solution is to pin beta.22's ngtools/webpack to version 1.1.9, instead of specifying the latest minor/patch version, which resolves to 1.2.1 according to npmjs

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions