Skip to content

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

Closed

Description

@rbirkgit

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

Activity

  1. leosvelperez commented on May 8, 2024

    @leosvelperez
    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?

  2. rbirkgit commented on May 8, 2024

    @rbirkgit
    Author

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

    Let me try with added verbose info.

  3. rbirkgit commented on May 8, 2024

    @rbirkgit
    Author

    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.
    
  4. leosvelperez commented on May 8, 2024

    @leosvelperez
    Member

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

  5. rbirkgit commented on May 8, 2024

    @rbirkgit
    Author

    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
    }
    
  6. rbirkgit commented on May 8, 2024

    @rbirkgit
    Author

    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"' ],
    
  7. leosvelperez commented on May 8, 2024

    @leosvelperez
    Member

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

  8. added a commit that references this issue on May 9, 2024
    534b24b
  9. rbirkgit commented on May 9, 2024

    @rbirkgit
    Author

    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.

  10. rbirkgit commented on May 9, 2024

    @rbirkgit
    Author

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

  11. leosvelperez commented on May 10, 2024

    @leosvelperez
    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.

  12. rbirkgit commented on May 10, 2024

    @rbirkgit
    Author

    That explains it! Thanks!

  13. MEANSTACKDIGITAL commented on Jun 10, 2024

    @MEANSTACKDIGITAL

    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/workspace@8.12.11
      - @nrwl/devkit@13.10.6
    
    To fix this, run `nx migrate nx@19.2.2`
    
    
    $ /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
    
  14. github-actions commented on Jul 11, 2024

    @github-actions
    Contributor

    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.

  15. locked as resolved and limited conversation to collaborators on Jul 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions