nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.29k stars 2.32k forks source link

nx migrate to 12.5.7 fails #6301

Closed overbit closed 3 years ago

overbit commented 3 years ago

Current Behaviour

Upgrade Nx to the current latest version 12.5.7 through the nx migrate latest process fails when applies migrations.

Expected Behaviour

Successful upgrade to latest version of nx.

Steps to Reproduce

From nx version 12.0.8, follow the guide to upgrade nx:

  1. nx migrate latest
  2. yarn
  3. nx migrate latest

Failure Logs

❯ yarn nx migrate --run-migrations
yarn run v1.22.10
$ nx migrate --run-migrations

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

[1/4] Resolving packages...
warning Resolution field "postcss-nested@5.0.1" is incompatible with requested version "postcss-nested@5.0.5"
success Already up-to-date.
$ husky install
husky - Git hooks installed

>  NX  Running migrations from 'migrations.json'

Running migration add-target-dependencies
Cannot read property 'options' of undefined
/home/diasella/workspaces/abcamdigital/abcam-web/node_modules/yargs/build/lib/yargs.js:1132
                throw err;
                ^

Error: Command failed: /tmp/tmp-9712-3VW0bNXif8VC/node_modules/.bin/tao migrate --run-migrations
    at checkExecSyncError (child_process.js:616:11)
    at Object.execSync (child_process.js:652:15)
    at Object.handler (/home/diasella/workspaces/abcamdigital/abcam-web/node_modules/@nrwl/workspace/src/command-line/nx-commands.js:89:25)
    at Object.runCommand (/home/diasella/workspaces/abcamdigital/abcam-web/node_modules/yargs/build/lib/command.js:196:48)
    at Object.parseArgs [as _parseArgs] (/home/diasella/workspaces/abcamdigital/abcam-web/node_modules/yargs/build/lib/yargs.js:1043:55)
    at Object.get [as argv] (/home/diasella/workspaces/abcamdigital/abcam-web/node_modules/yargs/build/lib/yargs.js:986:25)
    at Object.initLocal (/home/diasella/workspaces/abcamdigital/abcam-web/node_modules/@nrwl/cli/lib/init-local.js:25:79)
    at Object.<anonymous> (/home/diasella/workspaces/abcamdigital/abcam-web/node_modules/@nrwl/cli/bin/nx.js:43:18)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 9743,
  stdout: null,
  stderr: null
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Environment

  Node : 14.16.1
  OS   : linux x64
  yarn : 1.22.10

  nx : 12.5.7
  @nrwl/angular : Not Found
  @nrwl/cli : 12.5.7
  @nrwl/cypress : 12.5.7
  @nrwl/devkit : 12.5.7
  @nrwl/eslint-plugin-nx : 12.5.7
  @nrwl/express : Not Found
  @nrwl/jest : 12.5.7
  @nrwl/linter : 12.5.7
  @nrwl/nest : Not Found
  @nrwl/next : 12.5.7
  @nrwl/node : Not Found
  @nrwl/react : 12.5.7
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.5.7
  @nrwl/web : 12.5.7
  @nrwl/workspace : 12.5.7
  @nrwl/storybook : 12.5.7
  @nrwl/gatsby : Not Found
  typescript : 4.2.4
leosvelperez commented 3 years ago

Thanks for reporting this!

This issue was solved in https://github.com/nrwl/nx/pull/6252 and it'll be released in the next patch version. In the meantime, if you don't want to wait and want to proceed with the migration, you can make sure in your nx.json you have the default task runner with the options property specified inside tasksRunnerOptions, something like:

...
"tasksRunnerOptions": {
  "default": {
    "runner": "@nrwl/workspace/tasks-runners/default",
    "options": {
      "cacheableOperations": ["build", "test", "lint", "e2e"]
    }
  }
},
...

Please note that's an example, if you're using Nx Cloud, the task runner and the options will be different, but from what you're reporting, it seems you don't have the default task runner defined.

leosvelperez commented 3 years ago

I'm closing this one, the fix was released as part of Nx 12.6.0.

github-actions[bot] commented 1 year ago

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.