nx icon indicating copy to clipboard operation
nx copied to clipboard

Failed to install the latest version of the migration script.

Open r4b6i0 opened this issue 7 months ago • 2 comments

Current Behavior

Running nx migrate gives me an error Failed to install the latest version of the migration script. I tried migrating to and from many versions but it keeps happening: 19.6.7 -> 19.7.5, 19.7.5 -> 19.8.0, 19.8.0 -> 19.8.2

Expected Behavior

Running nx migrate should run the migration tool without showing the error Failed to install the latest version of the migration script.

GitHub Repo

No response

Steps to Reproduce

  1. nx migrate 19.7.5 --verbose

Nx Report

Node           : 18.20.4
OS             : win32-x64
Native Target  : x86_64-windows
pnpm           : 9.12.2

nx                 : 19.6.7
@nx/js             : 19.6.7
@nx/jest           : 19.6.7
@nx/linter         : 19.6.7
@nx/eslint         : 19.6.7
@nx/workspace      : 19.6.7
@nx/angular        : 19.6.7
@nx/cypress        : 19.6.7
@nx/devkit         : 19.6.7
@nx/esbuild        : 19.6.7
@nx/eslint-plugin  : 19.6.7
@nx/express        : 19.6.7
@nx/node           : 19.6.7
@nx/plugin         : 19.6.7
@nrwl/tao          : 19.6.7
@nx/web            : 19.6.7
@nx/webpack        : 19.6.7
typescript         : 5.5.4
---------------------------------------
Community plugins:
@ngrx/component       : 18.1.1
@ngrx/component-store : 18.1.1
@ngrx/effects         : 18.1.1
@ngrx/entity          : 18.1.1
@ngrx/operators       : 18.1.1
@ngrx/store           : 18.1.1
@ngrx/store-devtools  : 18.1.1
---------------------------------------
Local workspace plugins:
         @esteco/esp-shared-tools
         @esteco/pluginx

Failure Logs

> nx "migrate" "19.7.5" "--verbose"

Failed to install the latest version of the migration script. Using the current version.
Error: Command failed: pnpm install --no-frozen-lockfile
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at nxCliPath (V:\Projects\BeePMN-WEB\esteco\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_type_gtzarwkxtvo7wis6qpgeubmhau\node_modules\nx\src\command-line\migrate\command-object.js:139:38)
    at runMigration (V:\Projects\BeePMN-WEB\esteco\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_type_gtzarwkxtvo7wis6qpgeubmhau\node_modules\nx\src\command-line\migrate\command-object.js:91:19)
    at Object.handler (V:\Projects\BeePMN-WEB\esteco\node_modules\.pnpm\[email protected]_@[email protected]_@[email protected]_@[email protected]__@[email protected]_type_gtzarwkxtvo7wis6qpgeubmhau\node_modules\nx\src\command-line\migrate\command-object.js:19:9)
    at V:\Projects\BeePMN-WEB\esteco\node_modules\.pnpm\[email protected]\node_modules\yargs\build\index.cjs:1:8993
    at j (V:\Projects\BeePMN-WEB\esteco\node_modules\.pnpm\[email protected]\node_modules\yargs\build\index.cjs:1:4956)
    at _.handleValidationAndGetResult (V:\Projects\BeePMN-WEB\esteco\node_modules\.pnpm\[email protected]\node_modules\yargs\build\index.cjs:1:8962)
    at _.applyMiddlewareAndGetResult (V:\Projects\BeePMN-WEB\esteco\node_modules\.pnpm\[email protected]\node_modules\yargs\build\index.cjs:1:9604) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 30080,
  stdout: null,
  stderr: null
}
Fetching meta data about packages.
It may take a few minutes.
Fetching [email protected]
Fetching [email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]
Fetching @nx/[email protected]

 NX   The migrate command has run successfully.

- package.json has been updated.
- There are no migrations to run, so migrations.json has not been created.


 NX   Next steps:

- Make sure package.json changes make sense and then run 'pnpm install --no-frozen-lockfile',
- To learn more go to https://nx.dev/features/automate-updating-dependencies

Package Manager Version

No response

Operating System

  • [ ] macOS
  • [ ] Linux
  • [x] Windows
  • [ ] Other (Please specify)

Additional Information

No response

r4b6i0 avatar May 08 '25 16:05 r4b6i0

Thanks for reporting this!

Unfortunately, I can't reproduce the issue using a similar environment as yours and following the reproduction steps. It's currently difficult to identify the exact cause when the installation fails based only on the provided logs because the logged information is not too helpful. I just created a PR to improve this in the future, but it won't help with your currently installed version.

Could you provide a minimal repo where this can be reproduced?

Otherwise, would you be willing to help me debug this by patching your node_modules? If so, please update node_modules/nx/src/command-line/migrate/command-object.js:139 with the following:

        (0, child_process_2.execSync)(pmc.install, {
            cwd: tmpDir,
-           stdio: ['ignore', 'ignore', 'ignore'],
+           stdio: ['ignore', 'inherit', 'inherit'],
        });

Run the nx migrate command again and share the logs here.

leosvelperez avatar Jun 03 '25 12:06 leosvelperez

This issue has been automatically marked as stale because more information has not been provided within 7 days. It will be closed in 21 days if no information is provided. If information has been provided, please reply to keep it active. Thanks for being a part of the Nx community! 🙏

github-actions[bot] avatar Jun 11 '25 00:06 github-actions[bot]

This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.

github-actions[bot] avatar Aug 02 '25 00:08 github-actions[bot]