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.

Nx migrate does not work with Angular Material/CDK

See original GitHub issue

Current Behavior

Running nx migrate @angular/material or nx migrate @angular/cdk in the nx workspace fails with Cannot read property 'split' of undefined error.

Expected Behavior

I expect that to work especially if nx at the same time completely blocking my ability to use ng update.

Steps to Reproduce

Run nx migrate @angular/material in the project.

Failure Logs

nx migrate @angular/material
yarn run v1.22.4
$ /Users/<...>/angular-monorepo/node_modules/.bin/tao migrate @angular/material
Fetching meta data about packages.
It may take a few minutes.
Fetching @angular/material@latest
Fetching @angular/material@11.0.2

 ERROR  The migrate command failed. Try the following to migrate your workspace:

> npx @nrwl/tao@latest migrate @angular/material@latest
This will use the newest version of the migrate functionality, which might have your issue resolved.
----------------------------------------------------------------------------------------------------
Cannot read property 'split' of undefined
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
/Users/<...>/angular-monorepo/node_modules/yargs/build/lib/yargs.js:1132
                throw err;
                ^

Error: Command failed: yarn tao migrate @angular/material
    at checkExecSyncError (child_process.js:630:11)
    at Object.execSync (child_process.js:666:15)
    at Object.handler (/Users/<...>/angular-monorepo/node_modules/@nrwl/workspace/src/command-line/nx-commands.js:74:21)
    at Object.runCommand (/Users/<...>/angular-monorepo/node_modules/yargs/build/lib/command.js:196:48)
    at Object.parseArgs [as _parseArgs] (/Users/<...>/angular-monorepo/node_modules/yargs/build/lib/yargs.js:1043:55)
    at Object.get [as argv] (/Users/<...>/angular-monorepo/node_modules/yargs/build/lib/yargs.js:986:25)
    at Object.initLocal (/Users/<...>/angular-monorepo/node_modules/@nrwl/cli/lib/init-local.js:23:13)
    at Object.<anonymous> (/Users/<...>/angular-monorepo/node_modules/@nrwl/cli/bin/nx.js:41:18)
    at Module._compile (internal/modules/cjs/loader.js:1158:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 48247,
  stdout: null,
  stderr: null
}

Environment

Node : 12.16.1 OS : darwin x64 yarn : 1.22.4

nx : Not Found @nrwl/angular : 11.0.0 @nrwl/cli : 11.0.0 @nrwl/cypress : 11.0.0 @nrwl/devkit : 11.0.0 @nrwl/eslint-plugin-nx : Not Found @nrwl/express : Not Found @nrwl/jest : 11.0.0 @nrwl/linter : 11.0.0 @nrwl/nest : Not Found @nrwl/next : Not Found @nrwl/node : Not Found @nrwl/react : Not Found @nrwl/schematics : Not Found @nrwl/tao : 11.0.0 @nrwl/web : Not Found @nrwl/workspace : 11.0.0 typescript : 4.0.5

Issue Analytics

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

github_iconTop GitHub Comments

3reactions
kylecordescommented, Jan 23, 2021

It looks like the fix for this issue fixed it by not trying to execute migrations that would fail in this way.

I’m skeptical whether this really fixes things though; presumably these (in this example) CDK migrations exist for a reason, and should be executed to update application code in their intended way, not skipped?

3reactions
kylecannoncommented, Dec 14, 2020

Just an FYI @FrozenPandaz, for when I run the migration on the latest change I get the following for every single library:

Could not find TypeScript project for project: data-model
......redacted output of 20+ libraries...

      ✓  Updated Angular Material to version 11
    
Successfully finished migration-v11

I don’t know if thats expected?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Nx Upgrade from v11 to v12.10.1 is giving "Module not found ...
I believe it is the last update of Nx to use Angular 12 in my project. So far, here is what ... Run...
Read more >
nx cannot read properties of undefined (reading 'split') - You.com ...
When I run the code, it has this Error: var numbers = datArray [k].split (' ') TypeError: ... nrwl/nxNx migrate does not work...
Read more >
Upgrade to Angular 14 - Techiediaries
Use the ng update command of the Angular CLI; Use nx migate command of the Nx monorepo tool. You can read about the...
Read more >
Guide to update your Angular application v11.0 -> v12.0 for ...
Update to the new version ... Review these changes and perform the actions to update your application. Run ng update @angular/core@12 @angular/cli@12 which...
Read more >
Migrating an Angular CLI project to Nx
Within an Nx workspace, you gain many capabilities that help you build applications and libraries using a monorepo approach. If you are currently...
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