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

Failed to install the latest version of the migration script. #23222

Closed
1 of 4 tasks
rbirkgit opened this issue May 7, 2024 · 13 comments · Fixed by #23249
Closed
1 of 4 tasks

Failed to install the latest version of the migration script. #23222

rbirkgit opened this issue May 7, 2024 · 13 comments · Fixed by #23249
Assignees
Labels

Comments

@rbirkgit
Copy link

rbirkgit commented May 7, 2024

Current Behavior

I keep getting this error every time I update Nx. Is this normal or am I doing something wrong?

Failed to install the latest version of the migration script. Using the current version.

Then it says there are no new migrations and only updates Nx versions.

Expected Behavior

No errors.

GitHub Repo

No response

Steps to Reproduce

  1. nx migrate latest

Nx Report

Node   : 18.19.0
OS     : linux-x64
yarn   : 4.0.1

nx                 : 18.3.4
@nx/js             : 18.3.4
@nx/linter         : 18.3.4
@nx/eslint         : 18.3.4
@nx/workspace      : 18.3.4
@nx/angular        : 18.3.4
@nx/devkit         : 18.3.4
@nx/eslint-plugin  : 18.3.4
@nrwl/tao          : 18.3.4
@nx/web            : 18.3.4
@nx/webpack        : 18.3.4
typescript         : 5.4.5
---------------------------------------
Community plugins:
ng-mocks : 14.12.2

Failure Logs

No response

Package Manager Version

No response

Operating System

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

Additional Information

No response

@leosvelperez leosvelperez added the scope: core core nx functionality label May 8, 2024
@leosvelperez
Copy link
Member

Thanks for reporting this!

Could you please run with --verbose or NX_VERBOSE_LOGGING=true and share the error logs? Are you trying to migrate from Nx 18.3.4?

@rbirkgit
Copy link
Author

rbirkgit commented May 8, 2024

Yes, this time from 18.3.4 to 19.0.0. Got same issues with previous updates.

Let me try with added verbose info.

@rbirkgit
Copy link
Author

rbirkgit commented May 8, 2024

I ran this just now (18.3.4->19.0.1). Same error. --verbose didn't output anything more or any error logs.

root@RBIRK:/mnt/d/Git/cloud-ui# npx nx migrate latest --verbose
Failed to install the latest version of the migration script. Using the current version.

...

 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.

@leosvelperez
Copy link
Member

I see. Could you try running NX_VERBOSE_LOGGING=true npx nx migrate latest?

@rbirkgit
Copy link
Author

rbirkgit commented May 8, 2024

Got this now:

<ref *1> Error: spawnSync /bin/sh ENOENT
    at Object.spawnSync (node:internal/child_process:1117:20)
    at spawnSync (node:child_process:876:24)
    at execSync (node:child_process:957:15)
    at nxCliPath (/mnt/d/Git/cloud-ui/node_modules/nx/src/command-line/migrate/command-object.js:131:46)
    at runMigration (/mnt/d/Git/cloud-ui/node_modules/nx/src/command-line/migrate/command-object.js:90:19)
    at Object.handler (/mnt/d/Git/cloud-ui/node_modules/nx/src/command-line/migrate/command-object.js:18:9)
    at /mnt/d/Git/cloud-ui/node_modules/yargs/build/index.cjs:1:8993
    at j (/mnt/d/Git/cloud-ui/node_modules/yargs/build/index.cjs:1:4956)
    at _.handleValidationAndGetResult (/mnt/d/Git/cloud-ui/node_modules/yargs/build/index.cjs:1:8962)
    at _.applyMiddlewareAndGetResult (/mnt/d/Git/cloud-ui/node_modules/yargs/build/index.cjs:1:9604) {
  errno: -2,
  code: 'ENOENT',
  syscall: 'spawnSync /bin/sh',
  path: '/bin/sh',
  spawnargs: [ '-c', 'yarn set version 4.0.1' ],
  error: [Circular *1],
  status: null,
  signal: null,
  output: null,
  pid: 0,
  stdout: null,
  stderr: null
}

@rbirkgit
Copy link
Author

rbirkgit commented May 8, 2024

I tried directly in windows terminal and got same error. In the past migration has never worked well directly in windows, and why I switched to WSL.

Just in case, this is the difference from error above on windows. The rest of the error is identical.

  errno: -4058,
  code: 'ENOENT',
  syscall: 'spawnSync C:\\WINDOWS\\system32\\cmd.exe',
  path: 'C:\\WINDOWS\\system32\\cmd.exe',
  spawnargs: [ '/d', '/s', '/c', '"yarn set version 4.0.1"' ],

@leosvelperez
Copy link
Member

Thanks for the info! I've identified the issue and I'll push a fix.

FrozenPandaz pushed a commit that referenced this issue May 9, 2024
…3249)

<!-- Please make sure you have read the submission guidelines before
posting an PR -->
<!--
https://github.com/nrwl/nx/blob/master/CONTRIBUTING.md#-submitting-a-pr
-->

<!-- Please make sure that your commit message follows our format -->
<!-- Example: `fix(nx): must begin with lowercase` -->

## Current Behavior
<!-- This is the behavior we have today -->

## Expected Behavior
<!-- This is the behavior we should expect with the changes in this PR
-->

## Related Issue(s)
<!-- Please link the issue being fixed so it gets closed when this is
merged. -->

Fixes #23222

(cherry picked from commit 2460c89)
@rbirkgit
Copy link
Author

rbirkgit commented May 9, 2024

I still get the same error updating to 19.0.2.

Maybe the fix didn't make it? The release notes seem to indicate it did and why I tried.

@rbirkgit
Copy link
Author

rbirkgit commented May 9, 2024

@leosvelperez getting same error in my WSL ubuntu env too with 19.0.2

@leosvelperez
Copy link
Member

@rbirkgit it will still happen until you're migrated to Nx 19.0.2. After that, the error will go away. The reason is that the version you have installed has the issue. Only when you have Nx 19.0.2 (the version with the fix), the issue will go away.

@rbirkgit
Copy link
Author

rbirkgit commented May 10, 2024

That explains it! Thanks!

@nhhockeyplayer
Copy link

nhhockeyplayer commented Jun 10, 2024

I have 19.2.2 and its showing up
just an FYI

% nx report
 NX  Falling back to ts-node for local typescript execution. This may be a little slower.
  - To fix this, ensure @swc-node/register and @swc/core have been installed

 NX   Report complete - copy this into the issue template

Node   : 22.2.0
OS     : darwin-x64
yarn   : 1.22.22

nx (global)        : 19.2.2
nx                 : 19.2.2
@nx/js             : 19.2.2
@nx/jest           : 19.2.2
@nx/linter         : 19.2.2
@nx/eslint         : 19.2.2
@nx/workspace      : 19.2.2
@nrwl/workspace    : 8.12.11
@nx/angular        : 19.2.2
@nx/cypress        : 19.2.2
@nx/devkit         : 19.2.2
@nrwl/devkit       : 13.10.6
@nx/eslint-plugin  : 19.2.2
@nx/express        : 19.2.2
@nx/nest           : 19.2.2
@nx/node           : 19.2.2
@nx/storybook      : 19.2.2
@nrwl/tao          : 19.2.2
@nx/web            : 19.2.2
@nx/webpack        : 19.2.2
@nrwl/schematics   : 8.12.11
typescript         : 5.4.5
---------------------------------------
Community plugins:
@compodoc/compodoc                    : 1.1.25
@fortawesome/angular-fontawesome      : 0.11.1
@ionic/angular                        : 6.7.5
@ngneat/transloco                     : 4.3.0
@ngrx/component                       : 17.0.1
@ngrx/component-store                 : 17.0.1
@ngrx/effects                         : 17.0.1
@ngrx/entity                          : 17.0.1
@ngrx/router-store                    : 17.0.1
@ngrx/schematics                      : 17.0.1
@ngrx/store                           : 17.0.1
@ngrx/store-devtools                  : 17.0.1
@nxtend/capacitor                     : 13.0.0
@nxtend/ionic-angular                 : 13.1.0
@storybook/angular                    : 7.6.6
angular-builder-custom-terser-options : 1.0.1
apollo-angular                        : 4.2.1
---------------------------------------
The following packages should match the installed version of nx
  - @nrwl/[email protected]
  - @nrwl/[email protected]

To fix this, run `nx migrate [email protected]`

$ /Users/meanstack02/meanstacknh/node_modules/.bin/nx migrate --run-migrations
Failed to install the latest version of the migration script. Using the current version.
Error: Command failed: yarn
    at genericNodeError (node:internal/errors:983:15)
    at wrappedFn (node:internal/errors:537:14)
    at checkExecSyncError (node:child_process:889:11)
    at execSync (node:child_process:961:15)
    at nxCliPath (/Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/migrate/command-object.js:137:38)
    at runMigration (/Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/migrate/command-object.js:90:19)
    at Object.handler (/Users/meanstack02/meanstacknh/node_modules/nx/src/command-line/migrate/command-object.js:18:9)
    at /Users/meanstack02/meanstacknh/node_modules/yargs/build/index.cjs:1:8993
    at j (/Users/meanstack02/meanstacknh/node_modules/yargs/build/index.cjs:1:4956)
    at _.handleValidationAndGetResult (/Users/meanstack02/meanstacknh/node_modules/yargs/build/index.cjs:1:8962) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 8593,
  stdout: null,
  stderr: null
}
warning package.json: "dependencies" has dependency "dotenv" with range "^16.0.1" that collides with a dependency in "devDependencies" of the same name with version "^16.4.5"
$ /Users/meanstack02/meanstacknh/node_modules/.bin/nx _migrate --run-migrations

 NX   Running 'yarn' to make sure necessary packages are installed

Copy link

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 github-actions bot locked as resolved and limited conversation to collaborators Jul 11, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants