question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

bug(cdk): Update Failed : Cannot read property 'length' of null

See original GitHub issue

Reproduction

I can’t share my code because it’s a big project, hope the stack will help you ng update @angular/material --force

Expected Behavior

Working

Actual Behavior

 ** Executing migrations for package '@angular/cdk' **
Cannot read property 'length' of null

Stack trace in log file :

[error] TypeError: Cannot read property 'length' of null
    at Object.computeLineStartsMap (path\node_modules\@angular\cdk\schematics\update-tool\utils\line-mappings.js:39:23)
    at ComponentResourceCollector.resolveExternalStylesheet (path\node_modules\@angular\cdk\schematics\update-tool\component-resource-collector.js:131:47)
    at path\node_modules\@angular\cdk\schematics\update-tool\index.js:97:50
    at Array.forEach (<anonymous>)
    at UpdateProject.migrate (path\node_modules\@angular\cdk\schematics\update-tool\index.js:95:35)
    at runMigrations (path\node_modules\@angular\cdk\schematics\ng-update\devkit-migration-rule.js:128:42)
    at Object.<anonymous> (path\node_modules\@angular\cdk\schematics\ng-update\devkit-migration-rule.js:83:17)
    at Generator.next (<anonymous>)
    at path\node_modules\@angular\cdk\schematics\ng-update\devkit-migration-rule.js:15:71
    at new Promise (<anonymous>)
    at __awaiter (path\node_modules\@angular\cdk\schematics\ng-update\devkit-migration-rule.js:11:12)
    at path\node_modules\@angular\cdk\schematics\ng-update\devkit-migration-rule.js:57:31
    at MergeMapSubscriber.project (path\node_modules\@angular-devkit\schematics\src\rules\call.js:75:24)
    at MergeMapSubscriber._tryNext (path\node_modules\rxjs\internal\operators\mergeMap.js:69:27)
    at MergeMapSubscriber._next (path\node_modules\rxjs\internal\operators\mergeMap.js:59:18)
    at MergeMapSubscriber.Subscriber.next (path\node_modules\rxjs\internal\Subscriber.js:66:18)

Environment

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 10.0.0
Node: 12.4.0
OS: win32 x64

Angular: 10.0.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, material, platform-browser
... platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1000.0
@angular-devkit/build-angular     0.1000.0
@angular-devkit/build-optimizer   0.1000.0
@angular-devkit/build-webpack     0.1000.0
@angular-devkit/core              10.0.0
@angular-devkit/schematics        10.0.0
@angular/flex-layout              10.0.0-beta.32
@ngtools/webpack                  10.0.0
@schematics/angular               9.1.9
@schematics/update                0.1000.0
rxjs                              6.5.5
typescript                        3.9.5
webpack                           4.43.0
  • Operating System (e.g. Windows, macOS, Ubuntu): Windows 10

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
devversioncommented, Jul 1, 2020

Reopening this as the error has been fixed, but it doesn’t fix that actual stylesheets are not migrated. It looks like ng update has been run from within a different folder somehow. My understanding though was that the Angular CLI no longer supports this / that the devkit virtual tree always starts from the workspace root.

0reactions
angular-automatic-lock-bot[bot]commented, Aug 11, 2020

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.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot Read Property Length of Undefined in JavaScript
The JavaScript TypeError: Cannot read property 'length' of undefined occurs when the length property is read on an undefined variable.
Read more >
Cannot read property 'length' of null, javascript. Check if given ...
The error means that you're trying to access the .length property of something without first determining that the something is not null ....
Read more >
ERROR in Cannot read property &#38;#039;length&#38
Hi,. i just tried to migrate to Angular 9 and followed the Instruction. But getting this mistake: ERROR in Cannot read property 'length'...
Read more >
TypeError : Cannot read property "length" from null
When the scheduled rest call is run via Threat Intelligence Source, getting error below: TypeError : Cannot read property "length" from null.
Read more >
Typeerror: Cannot Read Property 'length' of Undefined
This error can be triggered with .length if the code is trying to access the property before it has been defined, so there...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found