angular-cli: Cannot read property 'ngMetadataName' of undefined with @angular-devkit/build-angular 0.800.4
π Bug report
Command (mark with an x
)
- [ ] new
- [ ] build
- [ ] serve
- [x] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Is this a regression?
Yes, the previous version in which this bug was not present was:
@angular-devkit/build-angular 0.800.3
Description
we met an error when update our lib ng-zorro-antd to the latest angular version.
All our ci goes wrong today, and found @angular-devkit update to 0.800.4, and everthing is ok after locking it to 0.800.3
TypeError: Cannot read property βngMetadataNameβ of undefined
π¬ Minimal Reproduction
- a success CI 19 hours ago(before 0.800.4 released): https://travis-ci.org/NG-ZORRO/ng-zorro-antd/jobs/549747080
- a failed CI 5 hours ago(after 0.800.4 released): https://travis-ci.org/NG-ZORRO/ng-zorro-antd/jobs/550062443 (no code change between these two CI)
- a sucess CI after seting
@angular-devkit/build-angular
to0.800.3
https://travis-ci.org/NG-ZORRO/ng-zorro-antd/jobs/550171528
π₯ Exception or Error
TypeError: Cannot read property 'ngMetadataName' of undefined
at injectArgs (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:573:1)
at http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:1091:72
at _callFactory (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:18522:1)
at _createProviderInstance (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:18480:1)
at resolveNgModuleDep (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:18455:1)
at NgModuleRef_.push.../node_modules/@angular/core/fesm5/core.js.NgModuleRef_.get (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:19149:1)
at resolveDep (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:19520:1)
at createClass (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:19400:1)
at createDirectiveInstance (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:19271:1)
at createViewNodes (http://localhost:9876/_karma_webpack_/webpack:/node_modules/@angular/core/fesm5/core.js:27489:1)
About this issue
- Original URL
- State: closed
- Created 5 years ago
- Reactions: 36
- Comments: 30
Commits related to this issue
- fix(core): handle `undefined` meta in `injectArgs` (#31333) In the recent versions of the CLI we introduced a ctor downleveler tranformer for VE JIT builds based on the one found in tsickle, to fix t... — committed to angular/angular by alan-agius4 5 years ago
- Issue-1143: Upgrading Angular dependencies (angular/angular-cli#14888) — committed to LeifBrooks/strongbox-web-ui by steve-todorov 5 years ago
I was just about to create the same ticket. I can confirm that our application was working with Angular CLI 8.0.3 and failed to load the SPA when upgrading to 8.0.4, as described above. We reverted to 8.0.3 and it works again.
Iβve just upgraded to 8.0.6 (from 8.0.3 because I also got hit by the other 8.0.4 issue: https://github.com/angular/angular-cli/pull/14891) and now Iβm getting this issue instead: https://puu.sh/DLODB/932e7842ee.png
Serving with
--aot
is a workaround because it works fine, but I guess this is still a regression.This project has about 50 apps/libs under an nx umbrella.
this error was fixed by the nightly build after checking, but the test error still there
@vadim-shb Have you downgraded the angular libraries as well. It seems that these are the latest ones were this error is not coming up: (Donβt forget the exact versions in package.json !!! I see in your config the ~ sign!!!) βdependenciesβ: { β@angular/animationsβ: β8.0.2β, β@angular/commonβ: β8.0.2β, β@angular/compilerβ: β8.0.2β, β@angular/coreβ: β8.0.2β, β@angular/formsβ: β8.0.2β, β@angular/platform-browserβ: β8.0.2β, β@angular/platform-browser-dynamicβ: β8.0.2β, β¦ βdevDependenciesβ: { β@angular-devkit/build-angularβ: β0.800.3β, β@angular-devkit/build-ng-packagrβ: β0.800.3β, β@angular/cliβ: β8.0.3β, β@angular/compiler-cliβ: β8.0.1β, β@angular/language-serviceβ: β8.0.1β,
After upgrading
@angular-devkit/build-angular
from0.800.3
to0.800.4
, I got compile errors as well:Reverting back to
0.800.3
resolves the errors (with@angular/cli
version8.0.3
/8.0.4
).This happens to me in the routes that I injected a service that injects the following:
The error occurred after updating to Angular 8. About workaround, I downgraded to 8.0.3 but still the same error. My package.json now :
It works fine with
ng serve --aot
With these packages β@angular-devkit/build-angularβ: β^0.800.6β, β@angular-devkit/build-ng-packagrβ: β^0.800.6β, β@angular/cliβ: β^8.0.6β,
It works ONLY with ng serve --aot
From @cexbrayat