nrwl/nx

Windows nx migrate Command failed

Opened this issue · 3 comments

Current Behavior

npx nx migrate nx@20.2.2
Fetching meta data about packages.
It may take a few minutes.
Fetching nx@20.2.2
Fetching nx@20.2.2
Fetching @nx/workspace@20.2.2
Fetching @nx/js@20.2.2
Fetching @nx/eslint@20.2.2
Fetching @nx/jest@20.2.2
Fetching @nx/node@20.2.2
Fetching @nx/nest@20.2.2
Fetching @nx/rspack@20.2.2
Fetching @nx/devkit@20.2.2
Fetching @nx/webpack@20.2.2
Fetching @nx/web@20.2.2
Fetching @nx/eslint-plugin@20.2.2
Fetching @nx/plugin@20.2.2
Fetching @nx/angular@20.2.2
Fetching @nx/workspace@20.2.2
Command failed: C:\Users\admin\AppData\Local\Temp\tmp-24648-25BCi0CV7Few\node_modules\.bin\nx _migrate nx@20.2.2

npx nx migrate nx@19.8.0
Fetching meta data about packages.
It may take a few minutes.
Fetching nx@19.8.0
Fetching nx@19.8.0
Fetching @nx/jest@19.8.0
Fetching @nx/js@19.8.0
Fetching @nx/workspace@19.8.0
Fetching @nx/web@19.8.0
Fetching @nx/node@19.8.0
Fetching @nx/nest@19.8.0
Fetching @nx/eslint@19.8.0
Fetching @nx/plugin@19.8.0
Fetching @nx/angular@19.8.0
Fetching @nx/devkit@19.8.0
Fetching @nx/webpack@19.8.0
Fetching @nx/eslint-plugin@19.8.0
Fetching @nx/jest@19.8.0
Command failed: C:\Users\admin\AppData\Local\Temp\tmp-14808-9gLWHQV3R4Kt\node_modules\.bin\nx _migrate nx@19.8.0

Expected Behavior

Successful migration.

GitHub Repo

No response

Steps to Reproduce

  1. nx migrate nx@latest

Nx Report

Node   : 18.20.4
OS     : win32-x64
npm    : 10.7.0

nx                 : 19.4.4
@nx/js             : 19.8.0
@nx/jest           : 19.4.4
@nx/linter         : 19.4.4
@nx/eslint         : 19.4.4
@nx/workspace      : 19.4.4
@nx/angular        : 19.4.4
@nx/devkit         : 19.4.4
@nx/eslint-plugin  : 19.4.4
@nx/nest           : 19.4.4
@nx/node           : 19.4.4
@nx/plugin         : 19.4.4
@nrwl/tao          : 19.4.4
@nx/web            : 19.4.4
@nx/webpack        : 19.4.4
typescript         : 5.4.5
---------------------------------------
Registered Plugins:
@nx/webpack/plugin
@nx/eslint/plugin
---------------------------------------
Community plugins:
@nx/rspack : 19.5.0
---------------------------------------
The following packages should match the installed version of nx
  - @nx/js@19.8.0
  - @nrwl/js@19.8.0

To fix this, run `nx migrate nx@19.8.0`

Failure Logs

Package Manager Version

No response

Operating System

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

Additional Information

No response

I got similar error by running npx nx migrate --run-migrations=migrations.json

Error: Command failed: C:\Users\user\AppData\Local\Temp\1\tmp-25248-FdIWUqiuE7Ls\node_modules\.bin\nx _migrate --run-migrations
    at genericNodeError (node:internal/errors:984:15)
    at wrappedFn (node:internal/errors:538:14)
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at Object.runMigration (C:\Users\user\Documents\projects\project\node_modules\nx\src\command-line\migrate\migrate.js:1073:42)
    at Object.handler (C:\Users\user\Documents\projects\project\node_modules\nx\src\command-line\migrate\command-object.js:13:68) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 8440,
  stdout: null,
  stderr: null
}

I got very similar error, in Windows using Bun v1.1.38:

Error: Command failed: C:\Users\santi\AppData\Local\Temp\tmp-33828-ulmVlF0OhLeO\node_modules\.bin\nx _migrate --run-migrations
    at checkExecSyncError (node:child_process:890:11)
    at execSync (node:child_process:962:15)
    at Object.runMigration (C:\Projects\hq-app\node_modules\nx\src\command-line\migrate\migrate.js:1073:42)
    at Object.handler (C:\Projects\hq-app\node_modules\nx\src\command-line\migrate\command-object.js:13:68) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 27884,
  stdout: null,
  stderr: null
}

I can confirm that this issue happens only in Windows. I ran all the migrations from Angular 18 to Angular 19 successfully in MacOS