Repository navigation
Closed
Milestone
Description
🐞 Bug report
Command (mark with an x)
- [ ] new
- [ ] build
- [ ] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [x] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc
Description
$ ng update @angular/core --from 7 --to 8 --migrate-only
------ Static Query migration ------
In preparation for Ivy, developers can now explicitly specify the
timing of their queries. Read more about this here:
https://github.com/angular/angular/pull/28810
There are two available migration strategies that can be selected:
• Template strategy - migration tool (short-term gains, rare corrections)
• Usage strategy - best practices (long-term gains, manual corrections)
For an easy migration, the template strategy is recommended. The usage
strategy can be used for best practices and a code base that will be more
flexible to changes going forward.
? What migration strategy do you want to use? Template strategy
Cannot read property 'module' of undefined
$ ng update @angular/core --from 7 --to 8 --migrate-only
------ Static Query migration ------
In preparation for Ivy, developers can now explicitly specify the
timing of their queries. Read more about this here:
https://github.com/angular/angular/pull/28810
There are two available migration strategies that can be selected:
• Template strategy - migration tool (short-term gains, rare corrections)
• Usage strategy - best practices (long-term gains, manual corrections)
For an easy migration, the template strategy is recommended. The usage
strategy can be used for best practices and a code base that will be more
flexible to changes going forward.
? What migration strategy do you want to use? Usage strategy
Cannot read property 'kind' of undefined
🔥 Exception or Error
Template strategy:
Cannot read property 'module' of undefined
Usage strategy:
Cannot read property 'kind' of undefined
🌍 Your Environment
Angular CLI: 8.0.0-rc.2
Node: 10.15.3
OS: linux x64
Angular: 8.0.0-rc.2
... animations, cli, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... platform-server, router
Package Version
--------------------------------------------------------------------
@angular-devkit/architect 0.800.0-rc.2
@angular-devkit/build-angular 0.800.0-rc.2
@angular-devkit/build-ng-packagr 0.800.0-rc.2
@angular-devkit/build-optimizer 0.800.0-rc.2
@angular-devkit/build-webpack 0.800.0-rc.2
@angular-devkit/core 8.0.0-rc.2
@angular-devkit/schematics 8.0.0-rc.2
@angular/cdk 8.0.0-rc.0
@angular/flex-layout 7.0.0-beta.24
@angular/http 8.0.0-beta.10+1.sha-a28b3e3
@angular/material 8.0.0-rc.0
@ngtools/json-schema 1.1.0
@ngtools/webpack 8.0.0-rc.2
@nguniversal/express-engine v7.0.2
@nguniversal/module-map-ngfactory-loader v7.0.2
@schematics/angular 8.0.0-rc.2
@schematics/update 0.800.0-rc.2
ng-packagr 5.1.0
rxjs 6.5.1
typescript 3.4.5
webpack 4.30.0
Note: flex-layout still doesn't support Angular 8: angular/flex-layout#1029
Maybe it is related to it?
I tried to install a local copy of @angular/cli in order to debug it, but I didn't succeed.
Despite yarn linking all of the following
@angular-devkit/core
@angular-devkit/schematics
@schematics/angular
@schematics/update
@angular-devkit/architect
@angular-devkit/build-optimizer
@angular-devkit/build-webpack
@ngtools/webpack
@angular-devkit/build-angular
@angular-devkit/build-ng-packagr
I still get:
$ ./node_modules/.bin/ng --version
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module '../lib/init'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/home/niko/WebstormProjects/deps/angular-cli/packages/angular/cli/bin/ng:25:1)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
Metadata
Metadata
Assignees
Labels
No labels
Activity
devversion commentedon May 5, 2019
Thanks for the issue @darkbasic. The template strategy actually uses the
@angular/compilerinternally and the exception seems to come from there. Can you confirm that serving the application with--aotactually works in your case? (after the update; also yes- it's possible that flex-layout is the culprit)The error for the usage strategy seems definitely like a bug. It's difficult to figure out where it comes from due to the error message not containing a stack trace, but I'll try to find it. Thanks!
If you have a chance, it would be awesome if you could:
node_modules/@angular/core/schematics/migrations/static-queries/strategies/usage_strategy/declaration_usage_visitor.js._updateContextand add a safety check forargumentNode(ensure it's not undefined).Finally, please rerun the usage strategy migration. If that fixed the issue, that would be great to know 😄
darkbasic commentedon May 5, 2019
Production build (aot, minification, etc.) works flawlessly.
For the
templatestrategy nothing changes: I still getCannot read property 'module' of undefinedand_updateContextnever gets called.On the contrary for the
usagestrategy it did the trick:Details
``` $ ./node_modules/.bin/ng update @angular/core --from 7 --to 8 --migrate-only ------ Static Query migration ------ In preparation for Ivy, developers can now explicitly specify the timing of their queries. Read more about this here: https://github.com//pull/28810? What migration strategy do you want to use? Usage strategy
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
!!! argumentNode is undefined !!!
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
_updateContext()
------------------------------------------------
UPDATE [...]
devversion commentedon May 5, 2019
@darkbasic Thank for helping with this. That confirms that the
_updateContextfix I've made in #30269 solves this issue.For the template strategy. I was able to reproduce this issue as well, but I'm not sure if it's similar to yours. Can you check if you have any
tsconfigfile where theangularCompilerOptionsare specified with someflatModuleXoptions? If so, it would be helpful to know where it is stored and if it is referenced in theangular.jsonfile.That is all. Thanks for the help! very appreciated 😄
devversion commentedon May 10, 2019
Fixes landed for the
_updateContextand a better messaging when the AOT compiler fails for the template strategy. I'll do some manual testing again, but I'm pretty sure the template strategy failure is caused by having a tsconfig withangularCompilerOptions>flatModuleXoptions set.See: #30269
angular-automatic-lock-bot commentedon Sep 15, 2019
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.