Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Nx failed to migrate older Angular version project 9.XX #26150

Closed
1 of 4 tasks
Jay1989 opened this issue May 28, 2024 · 11 comments
Closed
1 of 4 tasks

Nx failed to migrate older Angular version project 9.XX #26150

Jay1989 opened this issue May 28, 2024 · 11 comments
Assignees
Labels
scope: core core nx functionality type: bug

Comments

@Jay1989
Copy link

Jay1989 commented May 28, 2024

Current Behavior

getting migration errors in tao path
Error: Command failed: npm install
at checkExecSyncError (child_process.js:616:11)
at Object.execSync (child_process.js:652:15)
at taoPath (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules@nrwl\workspace\src\command-line\nx-commands.js:303:21)

Expected Behavior

it has to be succeeded

GitHub Repo

No response

Steps to Reproduce

  1. npx nx@10.4.15 migrate @nrwl/workspace@10.4.15
  2. npm install -–legacy-peer-deps
  3. npx nx migrate --run-migrations

Nx Report

C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\yargs.js:1132
                throw err;
                ^

Error: Command failed: npm install
    at checkExecSyncError (child_process.js:616:11)
    at Object.execSync (child_process.js:652:15)
    at taoPath (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\src\command-line\nx-commands.js:303:21)
    at Object.handler (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\src\command-line\nx-commands.js:77:19)
    at Object.runCommand (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\command.js:196:48)
    at Object.parseArgs [as _parseArgs] (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\yargs.js:1043:55)
    at Object.get [as argv] (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\yargs.js:986:25)
    at Object.initLocal (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\cli\lib\init-local.js:24:13)
    at Object.<anonymous> (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\cli\bin\nx.js:40:18)
    at Module._compile (internal/modules/cjs/loader.js:1063:30) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 24220,
  stdout: null,
  stderr: null
}

Failure Logs

C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\yargs.js:1132
                throw err;
                ^

Error: Command failed: npm install
    at checkExecSyncError (child_process.js:616:11)
    at Object.execSync (child_process.js:652:15)
    at taoPath (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\src\command-line\nx-commands.js:303:21)
    at Object.handler (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\src\command-line\nx-commands.js:77:19)
    at Object.runCommand (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\command.js:196:48)
    at Object.parseArgs [as _parseArgs] (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\yargs.js:1043:55)
    at Object.get [as argv] (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\workspace\node_modules\yargs\build\lib\yargs.js:986:25)
    at Object.initLocal (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\cli\lib\init-local.js:24:13)
    at Object.<anonymous> (C:\CI-UI-Workspace\WOA_Workspace2\CI-UI-Workspace\node_modules\@nrwl\cli\bin\nx.js:40:18)
    at Module._compile (internal/modules/cjs/loader.js:1063:30) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 24220,
  stdout: null,
  stderr: null
}

Package Manager Version

6.14.8

Operating System

  • macOS
  • Linux
  • Windows
  • Other (Please specify)

Additional Information

node version 14.15.0
npm version 6.14.8
Angular migration - 9.xx to 10.xx

@FrozenPandaz FrozenPandaz added the scope: core core nx functionality label Jun 3, 2024
@Jay1989
Copy link
Author

Jay1989 commented Jun 5, 2024

Why this taoPath function checking these dependency latest. All the existing project is not at latest Angular version and suppose we want to migrate any old angular version like Angular 9 then we can't directly jump to 17. We need to go step by step like 1st Angular 9 to Angular 10 then 11 then 12 like this.
I believe this checks creating issue. Looking your support he.
image

@leosvelperez
Copy link
Member

Thanks for reporting this!

Could please share the nx report output?

@Jay1989
Copy link
Author

Jay1989 commented Jun 7, 2024

Please check below image
Angular 9 to Angular 10 migration nx report:
so, this is failing while running "npx nx migrate --run-migrations"
image

we have similar issue while migrating Angular 12 apps
Please check nx report of this migration as well.
Angular 12 to Angular 13 migration nx report
This is failing while runnign 1st command it self "nx migrate @nrwl/workspace@14.1.9"
image

@Jay1989
Copy link
Author

Jay1989 commented Jun 10, 2024

We have run set NX_MIGRATE_USE_LOCAL=true so that migration use local copy. now it fails at Angular CLI update. Not able to understand if we are migrating Angular 9 to 10, Why CLI looking latest version.

image

@leosvelperez
Copy link
Member

Thanks for the provided information.

Setting NX_MIGRATE_USE_LOCAL=true is the right thing to do for such an old version of Nx. Please try again also setting NG_DISABLE_VERSION_CHECK=true to disable the Angular CLI check.

Let me know if that solves the issue.

@Jay1989
Copy link
Author

Jay1989 commented Jun 11, 2024

Use this above two flags. look like migration is succeeding partially. all the dependencies not updating even Angular cdk, Angular material still its old version. Attach screenshot for more details:
do we need to migrate these dependency individually
like npm i @angular/cdk@10.1.3 and npm i @angular/material@10.1.3 ??
image

@leosvelperez
Copy link
Member

@Jay1989 Unfortunately, back in the day, the @nrwl/angular package did not handle migrations for the Angular Material packages. So, you'll need to migrate them yourself:

nx migrate @angular/cdk@10.1.3
nx migrate @angular/material@10.1.3

Remember to run the above with the same env variables as before.

@Jay1989
Copy link
Author

Jay1989 commented Jun 11, 2024

Please find below error while migrating Angular CDK and Angular material
same as #4262
image
further investigate function it fails at below place:
image

@leosvelperez
Copy link
Member

I see. Unfortunately, the fix for that issue was only released in Nx 11, and you're using an Nx version that's out of our support window.

The next suggestion is far from ideal and something we'd never suggest for supported versions of Nx, but I think it is the best that can be done at this point for such an old version. You can try manually applying the fix in https://github.com/nrwl/nx/pull/4267/files to the tao package in your node_modules. The fix is simple enough and it's hopefully enough to get the issue sorted out 🤞🏻

Please let me know how it goes and if you need further assistance.

@Jay1989
Copy link
Author

Jay1989 commented Jun 17, 2024

@leosvelperez
Done as suggested. migrated from Angular 10 to Angular 12. Now package json using Angular material 12 version
image
but, internal file structure still old. why internal code not update as per Angular material 12 version.
For Exp:
Still my code look like older structure
image
V12 Material code look like below
image

So, Do we need to update manually. since nx migration not able to handle this change.

@leosvelperez
Copy link
Member

@Jay1989 the Angular Material migrations are not provided by Nx. Those are written and provided by the Angular team. Nx is only the CLI running the migrations. So, if there's an issue with the changes the migrations perform (or don't perform), that's something to check in the Angular Material repo.

I'm going to close this issue since the original issue about the Nx CLI not running certain updates has already been addressed. Please feel free to create new issues if you find anything else is not working as you'd expect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scope: core core nx functionality type: bug
Projects
None yet
Development

No branches or pull requests

3 participants