nx: Consistent failure migrating from 12.0.8 to 12.1.0 or later

Current Behavior

I am seeing a consistent failure when migrating from 12.0.8 to 12.1.0 or later.

Cannot convert undefined or null to object

(full error below)

  • I’ve tried migrating to latest, 12.4.0, 12.3.6, 12.3.0 and 12.1.0.
  • As one issue suggested, I have tried after deleting node_modules and package-lock.json
  • As another issue suggested, I have verified that all projects have an architect key in angular.json
    • (fwiw there was a single project that was missing this but I added it in and the migration still fails)
  • As another issue suggested, I verified that tsconfig.base.json has a paths key.
  • As another issue suggested, I verified that the base package.json has a dependencies key.

I have hit NX upgrade snags before but have been able to figure out a way around them but this time I’m a bit out of my depth.

Expected Behavior

Obviously the expected behavior is a successful upgrade 🙃

Steps to Reproduce

As I cannot reproduce this outside of our repo, I hesitate to call this a bug. But I am hoping someone can help point me in a better direction.

Failure Logs

Error output
Running migration update-12-1-0
admin: no storybook configured. skipping migration...
analytics: no storybook configured. skipping migration...
animations: no storybook configured. skipping migration...
auth: no storybook configured. skipping migration...
brochure: no storybook configured. skipping migration...
dao: no storybook configured. skipping migration...
cards: no storybook configured. skipping migration...
claim-account: no storybook configured. skipping migration...
claim-invite: no storybook configured. skipping migration...
config: no storybook configured. skipping migration...
core: no storybook configured. skipping migration...
cypress: no storybook configured. skipping migration...
layouts: no storybook configured. skipping migration...
order-checks: no storybook configured. skipping migration...
pipes: no storybook configured. skipping migration...
portal: no storybook configured. skipping migration...
postcss-themes: no storybook configured. skipping migration...
shared: no storybook configured. skipping migration...
Cannot convert undefined or null to object
/Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/workspace/node_modules/yargs/build/lib/yargs.js:1132
                throw err;
                ^

Error: Command failed: /var/folders/37/98bg5khn7_30nfbbwc6yb1g40000gn/T/tmp-77773-XZq4fTc6xGC6/node_modules/.bin/tao migrate --run-migrations
    at checkExecSyncError (child_process.js:630:11)
    at Object.execSync (child_process.js:666:15)
    at Object.handler (/Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/workspace/src/command-line/nx-commands.js:90:25)
    at Object.runCommand (/Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/workspace/node_modules/yargs/build/lib/command.js:196:48)
    at Object.parseArgs [as _parseArgs] (/Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/workspace/node_modules/yargs/build/lib/yargs.js:1043:55)
    at Object.get [as argv] (/Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/workspace/node_modules/yargs/build/lib/yargs.js:986:25)
    at Object.initLocal (/Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/cli/lib/init-local.js:26:79)
    at Object.<anonymous> (/Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/cli/bin/nx.js:43:18)
    at Module._compile (internal/modules/cjs/loader.js:1137:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 77811,
  stdout: null,
  stderr: null
}

Environment

NX Report
  Node : 12.18.3
  OS   : darwin x64
  npm  : 6.14.6

  nx : Not Found
  @nrwl/angular : 12.1.0
  @nrwl/cli : 12.1.0
  @nrwl/cypress : 12.1.0
  @nrwl/devkit : 12.1.0
  @nrwl/eslint-plugin-nx : 12.1.0
  @nrwl/express : Not Found
  @nrwl/jest : 12.1.0
  @nrwl/linter : 12.1.0
  @nrwl/nest : Not Found
  @nrwl/next : Not Found
  @nrwl/node : 12.1.0
  @nrwl/react : Not Found
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.1.0
  @nrwl/web : Not Found
  @nrwl/workspace : 12.1.0
  @nrwl/storybook : 12.1.0
  @nrwl/gatsby : Not Found
  typescript : 4.0.5

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Comments: 17 (6 by maintainers)

Commits related to this issue

Most upvoted comments

Just did some debugging on this myself. In my case I had a project listed in the angular.json that did not have an architect property.

"styles": {
      "root": "libs/styles",
      "sourceRoot": "libs/styles/src",
      "projectType": "library",
    -->  "architect": {} // this seems to be required for certain migrations to work since it's looping through the 'targets' and without it, 'targets' is null.
    }

just adding architect:{} solved it for me to all projects that were missing them.