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

Consistent failure migrating from 12.0.8 to 12.1.0 or later #6128

Closed
benjamincharity opened this issue Jun 25, 2021 · 17 comments · Fixed by #6490
Closed

Consistent failure migrating from 12.0.8 to 12.1.0 or later #6128

benjamincharity opened this issue Jun 25, 2021 · 17 comments · Fixed by #6490
Assignees
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: bug

Comments

@benjamincharity
Copy link

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
@FrozenPandaz FrozenPandaz added the scope: storybook Issues related to Storybook support in Nx label Jun 25, 2021
@FrozenPandaz
Copy link
Collaborator

@benjamincharity can you please rerun the command with verbose, nx migrate --run-migrations --verbose and post the stack trace?

I suspect it is because of this migration: https://github.com/nrwl/nx/blob/master/packages/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.ts#L51

@benjamincharity
Copy link
Author

Thanks for the quick response!

It looks like you're on the right track:

➜  web git:(OPEN2-25731-nx12-upgrade) ✗ nx migrate --run-migrations --verbose

>  NX  Running 'npm install' to make sure necessary packages are installed


> apiture-web@0.2.278 postinstall /Users/benjamin.charity/code/apiture/web
> ngcc  --create-ivy-entry-points --properties es2015 browser module main && husky install && nx package postcss-themes --skip-nx-cache && npm run build:schema:all

husky - Git hooks installed

> nx run postcss-themes:package
Compiling TypeScript files for project "postcss-themes"...
Done compiling TypeScript files for project "postcss-themes".
Copying asset files...
Done copying asset files.

———————————————————————————————————————————————

>  NX   SUCCESS  Running target "package" succeeded



>  NX   CLOUD  See run details at https://nx.app/runs/9sBo3YJd4Xg


> apiture-web@0.2.278 build:schema:all /Users/benjamin.charity/code/apiture/web
> npm run build:schema:apiture-lib & npm run build:schema:apiture-component


> apiture-web@0.2.278 build:schema:apiture-component /Users/benjamin.charity/code/apiture/web
> json2ts tools/generators/apiture-component/schema.json > tools/generators/apiture-component/schema.ts


> apiture-web@0.2.278 build:schema:apiture-lib /Users/benjamin.charity/code/apiture/web
> json2ts tools/generators/apiture-lib/schema.json > tools/generators/apiture-lib/schema.ts

npm WARN @angular-devkit/build-angular@0.1002.3 requires a peer of @angular/compiler-cli@^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular-eslint/builder@1.2.0 requires a peer of @angular-devkit/architect@~0.1001.4 || ~0.1100.1 but none is installed. You must install peer dependencies yourself.
npm WARN jasmine-ts@0.3.0 requires a peer of ts-node@>=3.2.0 <8 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.14.5 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-proposal-class-static-block@7.14.5 requires a peer of @babel/core@^7.12.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ngtools/webpack@10.2.3 requires a peer of @angular/compiler-cli@^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @phenomnomnominal/tsquery@4.0.0 requires a peer of typescript@^3 but none is installed. You must install peer dependencies yourself.
npm WARN @rollup/plugin-commonjs@17.1.0 requires a peer of rollup@^2.30.0 but none is installed. You must install peer dependencies yourself.
npm WARN @storybook/addon-docs@6.2.9 requires a peer of @babel/core@^7.11.5 but none is installed. You must install peer dependencies yourself.
npm WARN @storybook/addon-essentials@6.2.9 requires a peer of @babel/core@^7.9.6 but none is installed. You must install peer dependencies yourself.
npm WARN acorn-jsx@5.3.1 requires a peer of acorn@^6.0.0 || ^7.0.0 || ^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN babel-plugin-apply-mdx-type-prop@1.6.22 requires a peer of @babel/core@^7.11.6 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@4.5.0 requires a peer of @angular/compiler@>=2.3.1 <8.0.0 || >7.0.0-beta <8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@4.5.0 requires a peer of @angular/core@>=2.3.1 <8.0.0 || >7.0.0-beta <8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@4.5.0 requires a peer of tslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN cypress-file-upload@3.5.3 requires a peer of cypress@^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb@18.2.1 requires a peer of eslint-plugin-react@^7.21.5 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb@18.2.1 requires a peer of eslint-plugin-react-hooks@^4 || ^3 || ^2.3.0 || ^1.7.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb-typescript@8.0.2 requires a peer of @typescript-eslint/eslint-plugin@^3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN inquirer-autocomplete-prompt@1.0.1 requires a peer of inquirer@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngrx-store-localstorage@7.0.1 requires a peer of @ngrx/store@^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-countdown@10.0.2 requires a peer of @angular/core@^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-markdown@7.1.5 requires a peer of @angular/common@^6.0.0 || ^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-markdown@7.1.5 requires a peer of @angular/core@^6.0.0 || ^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-markdown@7.1.5 requires a peer of @angular/platform-browser@^6.0.0 || ^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-markdown@7.1.5 requires a peer of core-js@^2.5.4 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-markdown@7.1.5 requires a peer of zone.js@^0.8.26 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-uploader@8.0.0 requires a peer of @angular/common@^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-uploader@8.0.0 requires a peer of @angular/core@^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-get-random-values@1.7.0 requires a peer of react-native@>=0.56 but none is installed. You must install peer dependencies yourself.
npm WARN storybook-addon-angular-router@1.1.1 requires a peer of @angular/router@^11.2.7 but none is installed. You must install peer dependencies yourself.
npm WARN storybook-addon-angular-router@1.1.1 requires a peer of rxjs@^6.6.7 but none is installed. You must install peer dependencies yourself.
npm WARN stylelint-config-sass-guidelines@5.4.0 requires a peer of stylelint@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN stylelint-order@2.2.1 requires a peer of stylelint@^9.10.1 || ^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tailwindcss@2.2.0 requires a peer of autoprefixer@^10.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN tsickle@0.43.0 requires a peer of typescript@~4.3 but none is installed. You must install peer dependencies yourself.
npm WARN The package @angular/compiler is included as both a dev and production dependency.

removed 1 package in 33.15s

321 packages are looking for funding
  run `npm fund` for details


>  NX  Running migrations from 'migrations.json'

Running migration ngrx-effects-migration-02
Successfully finished ngrx-effects-migration-02
---------------------------------------------------------
Running migration ngrx-router-store-migration-03
    [@ngrx/router-store] Updated StoreRouterConnectingModule's configuration, see the migration guide (https://ngrx.io/guide/migration/v9#ngrxrouter-store) for more info
Successfully finished ngrx-router-store-migration-03
---------------------------------------------------------
Running migration update-jest-preset-angular-8-4-0
Successfully finished update-jest-preset-angular-8-4-0
---------------------------------------------------------
Running migration update-ts-jest-6-5-5
Successfully finished update-ts-jest-6-5-5
---------------------------------------------------------
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
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at /Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js:16:46
    at Map.forEach (<anonymous>)
    at /Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js:10:18
    at Generator.next (<anonymous>)
    at /Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:113:16)
    at updateStorybookTsconfig (/Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js:7:20)
    at /private/var/folders/37/98bg5khn7_30nfbbwc6yb1g40000gn/T/tmp-14351-AECnLwlIFsGM/node_modules/@nrwl/tao/src/commands/migrate.js:521:15
/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-14351-AECnLwlIFsGM/node_modules/.bin/tao migrate --run-migrations --verbose
    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: 14379,
  stdout: null,
  stderr: null
}

@benjamincharity
Copy link
Author

It seems to be failing at a specific library. It is a newer addition that I've inherited but to my eyes the files all seem pretty similar.

I did notice that some storybook config files didn't match other libraries, but after aligning them I received the same error:

Error
➜  web git:(OPEN2-25731-nx12-upgrade) ✗ nx migrate --run-migrations --verbose

>  NX  Running 'npm install' to make sure necessary packages are installed


> apiture-web@0.2.278 postinstall /Users/benjamin.charity/code/apiture/web
> ngcc  --create-ivy-entry-points --properties es2015 browser module main && husky install && nx package postcss-themes --skip-nx-cache && npm run build:schema:all

husky - Git hooks installed

> nx run postcss-themes:package
Compiling TypeScript files for project "postcss-themes"...
Done compiling TypeScript files for project "postcss-themes".
Copying asset files...
Done copying asset files.

———————————————————————————————————————————————

>  NX   SUCCESS  Running target "package" succeeded



>  NX   CLOUD  See run details at https://nx.app/runs/7zDit7WACZa


> apiture-web@0.2.278 build:schema:all /Users/benjamin.charity/code/apiture/web
> npm run build:schema:apiture-lib & npm run build:schema:apiture-component


> apiture-web@0.2.278 build:schema:apiture-component /Users/benjamin.charity/code/apiture/web
> json2ts tools/generators/apiture-component/schema.json > tools/generators/apiture-component/schema.ts


> apiture-web@0.2.278 build:schema:apiture-lib /Users/benjamin.charity/code/apiture/web
> json2ts tools/generators/apiture-lib/schema.json > tools/generators/apiture-lib/schema.ts

npm WARN @angular-devkit/build-angular@0.1002.3 requires a peer of @angular/compiler-cli@^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @angular-eslint/builder@1.2.0 requires a peer of @angular-devkit/architect@~0.1001.4 || ~0.1100.1 but none is installed. You must install peer dependencies yourself.
npm WARN jasmine-ts@0.3.0 requires a peer of ts-node@>=3.2.0 <8 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining@7.14.5 requires a peer of @babel/core@^7.13.0 but none is installed. You must install peer dependencies yourself.
npm WARN @babel/plugin-proposal-class-static-block@7.14.5 requires a peer of @babel/core@^7.12.0 but none is installed. You must install peer dependencies yourself.
npm WARN @ngtools/webpack@10.2.3 requires a peer of @angular/compiler-cli@^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @phenomnomnominal/tsquery@4.0.0 requires a peer of typescript@^3 but none is installed. You must install peer dependencies yourself.
npm WARN @rollup/plugin-commonjs@17.1.0 requires a peer of rollup@^2.30.0 but none is installed. You must install peer dependencies yourself.
npm WARN @storybook/addon-docs@6.2.9 requires a peer of @babel/core@^7.11.5 but none is installed. You must install peer dependencies yourself.
npm WARN @storybook/addon-essentials@6.2.9 requires a peer of @babel/core@^7.9.6 but none is installed. You must install peer dependencies yourself.
npm WARN acorn-jsx@5.3.1 requires a peer of acorn@^6.0.0 || ^7.0.0 || ^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN babel-plugin-apply-mdx-type-prop@1.6.22 requires a peer of @babel/core@^7.11.6 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@4.5.0 requires a peer of @angular/compiler@>=2.3.1 <8.0.0 || >7.0.0-beta <8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@4.5.0 requires a peer of @angular/core@>=2.3.1 <8.0.0 || >7.0.0-beta <8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN codelyzer@4.5.0 requires a peer of tslint@^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN cypress-file-upload@3.5.3 requires a peer of cypress@^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb@18.2.1 requires a peer of eslint-plugin-react@^7.21.5 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb@18.2.1 requires a peer of eslint-plugin-react-hooks@^4 || ^3 || ^2.3.0 || ^1.7.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb-typescript@8.0.2 requires a peer of @typescript-eslint/eslint-plugin@^3.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN inquirer-autocomplete-prompt@1.0.1 requires a peer of inquirer@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngrx-store-localstorage@7.0.1 requires a peer of @ngrx/store@^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0 || ^8.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-countdown@10.0.2 requires a peer of @angular/core@^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-markdown@7.1.5 requires a peer of @angular/common@^6.0.0 || ^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-markdown@7.1.5 requires a peer of @angular/core@^6.0.0 || ^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-markdown@7.1.5 requires a peer of @angular/platform-browser@^6.0.0 || ^7.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-markdown@7.1.5 requires a peer of core-js@^2.5.4 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-markdown@7.1.5 requires a peer of zone.js@^0.8.26 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-uploader@8.0.0 requires a peer of @angular/common@^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN ngx-uploader@8.0.0 requires a peer of @angular/core@^8.2.14 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-get-random-values@1.7.0 requires a peer of react-native@>=0.56 but none is installed. You must install peer dependencies yourself.
npm WARN storybook-addon-angular-router@1.1.1 requires a peer of @angular/router@^11.2.7 but none is installed. You must install peer dependencies yourself.
npm WARN storybook-addon-angular-router@1.1.1 requires a peer of rxjs@^6.6.7 but none is installed. You must install peer dependencies yourself.
npm WARN stylelint-config-sass-guidelines@5.4.0 requires a peer of stylelint@^9.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN stylelint-order@2.2.1 requires a peer of stylelint@^9.10.1 || ^10.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN tailwindcss@2.2.0 requires a peer of autoprefixer@^10.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN tsickle@0.43.0 requires a peer of typescript@~4.3 but none is installed. You must install peer dependencies yourself.
npm WARN The package @angular/compiler is included as both a dev and production dependency.

removed 1 package in 34.475s

321 packages are looking for funding
  run `npm fund` for details


>  NX  Running migrations from 'migrations.json'

Running migration ngrx-effects-migration-02
Successfully finished ngrx-effects-migration-02
---------------------------------------------------------
Running migration ngrx-router-store-migration-03
    [@ngrx/router-store] Updated StoreRouterConnectingModule's configuration, see the migration guide (https://ngrx.io/guide/migration/v9#ngrxrouter-store) for more info
Successfully finished ngrx-router-store-migration-03
---------------------------------------------------------
Running migration update-jest-preset-angular-8-4-0
Successfully finished update-jest-preset-angular-8-4-0
---------------------------------------------------------
Running migration update-ts-jest-6-5-5
Successfully finished update-ts-jest-6-5-5
---------------------------------------------------------
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
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at /Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js:16:46
    at Map.forEach (<anonymous>)
    at /Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js:10:18
    at Generator.next (<anonymous>)
    at /Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:113:16)
    at updateStorybookTsconfig (/Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js:7:20)
    at /private/var/folders/37/98bg5khn7_30nfbbwc6yb1g40000gn/T/tmp-20739-OilrEqSB5BgF/node_modules/@nrwl/tao/src/commands/migrate.js:521:15
/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-20739-OilrEqSB5BgF/node_modules/.bin/tao migrate --run-migrations --verbose
    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: 20754,
  stdout: null,
  stderr: null
}

I unfortunately cannot share the entire library, but I'll add tsconfig files below in case anything jumps out.

tsconfig
{
  "extends": "../../tsconfig.base.json",
  "files": [],
  "include": [],
  "references": [
    {
      "path": "./tsconfig.lib.json"
    },
    {
      "path": "./tsconfig.lib.prod.json"
    },
    {
      "path": "./tsconfig.spec.json"
    },
    {
      "path": "./.storybook/tsconfig.json"
    }
  ]
}
tsconfig.lib
{
  "angularCompilerOptions": {
    "enableResourceInlining": true,
    "skipTemplateCodegen": true,
    "strictMetadataEmit": true
  },
  "compilerOptions": {
    "declaration": true,
    "inlineSources": true,
    "lib": ["dom", "es2018"],
    "outDir": "../../dist/out-tsc",
    "target": "es2015",
    "types": []
  },
  "exclude": ["src/test-setup.ts", "**/*.spec.ts", "**/*.stories.ts", "**/*.stories.js"],
  "extends": "./tsconfig.json",
  "include": ["**/*.ts"]
}

@mandarini mandarini self-assigned this Jun 27, 2021
@benjamincharity
Copy link
Author

Note: I was able to successfully migrate to 12.0.0 so all the errors seen above are when trying to migrate from 12.0.0 to a later version.

@mandarini
Copy link
Member

Hi @benjamincharity ! Can you try the migrations using the latest version of Nx? Just in case it somehow gets resolved. And after you try it, can you please post your logs here again? Thank you very much in advance, and I hope your issue gets resolved quickly!

@kpaxton
Copy link
Contributor

kpaxton commented Jul 1, 2021

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.

@benjamincharity
Copy link
Author

Alright @mandarini I finally got some time to try this.. I updated to @nrwl/cli@12.5.1 before trying the migrations.

Migrating from 12.0.8 to latest was still failing but migrating to 12.1.0 did work.

Once on 12.1.0 I again tried running nx migrate latest and the setup succeeded but running npm i fails on TypeError: compiler_1.createR3ProviderExpression is not a function:

➜  web git:(OPEN2-25731-nx12-upgrade) npm i
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)

> core-js@3.15.1 postinstall /Users/benjamin.charity/code/apiture/web/node_modules/@angular-devkit/build-angular/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> @angular/cli@12.1.0 postinstall /Users/benjamin.charity/code/apiture/web/node_modules/@angular/cli
> node ./bin/postinstall/script.js


> @nrwl/angular@12.5.1 postinstall /Users/benjamin.charity/code/apiture/web/node_modules/@nrwl/angular
> node ./scripts/nx-cli-warning.js


> apiture-web@0.2.278 postinstall /Users/benjamin.charity/code/apiture/web
> ngcc  --create-ivy-entry-points --properties es2015 browser module main && husky install && nx package postcss-themes --skip-nx-cache && npm run build:schema:all

Compiling @angular/compiler/testing : es2015 as esm2015
Compiling @angular/cdk/keycodes : es2015 as esm2015
Compiling @angular/core : es2015 as esm2015
Compiling @angular/animations : es2015 as esm2015
Compiling @angular/service-worker/config : es2015 as esm2015
Compiling @nrwl/angular/testing : es2015 as esm2015
Compiling angular2-fontawesome : module as esm5
Compiling @angular/animations : main as umd
Compiling @angular/cdk/keycodes : main as umd
Compiling @angular/service-worker/config : main as umd
Compiling @angular/compiler/testing : main as umd
Compiling angular2-fontawesome : main as commonjs
Compiling @nrwl/angular/testing : main as umd
Error: Error on worker #1: TypeError: compiler_1.createR3ProviderExpression is not a function
    at extractInjectableMetadata (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/injectable.js:140:40)
    at InjectableDecoratorHandler.analyze (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/injectable.js:70:24)
    at NgccTraitCompiler.TraitCompiler.analyzeTrait (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:397:40)
    at analyze (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:347:58)
    at _loop_1 (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:369:21)
    at NgccTraitCompiler.TraitCompiler.analyzeClass (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:375:35)
    at NgccTraitCompiler.analyzeFile (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/analysis/ngcc_trait_compiler.js:49:26)
    at DecorationAnalyzer.analyzeProgram (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/analysis/decoration_analyzer.js:150:39)
    at Transformer.analyzeProgram (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/packages/transformer.js:135:57)
    at Transformer.transform (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/packages/transformer.js:77:27)
    at ClusterMaster.onWorkerMessage (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:195:27)
    at /Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:55:95
    at ClusterMaster.<anonymous> (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:293:57)
    at step (/Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:143:27)
    at Object.next (/Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:124:57)
    at /Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:113:16)
    at EventEmitter.<anonymous> (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:287:32)
    at EventEmitter.emit (events.js:315:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! apiture-web@0.2.278 postinstall: `ngcc  --create-ivy-entry-points --properties es2015 browser module main && husky install && nx package postcss-themes --skip-nx-cache && npm run build:schema:all`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the apiture-web@0.2.278 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/benjamin.charity/.npm/_logs/2021-07-01T15_02_59_632Z-debug.log

I was able to migrate from 12.1.0 to 12.2.0 successfully, but then I'm seeing the same error when trying to npm i after running nx migrate 12.3.0:

➜  web git:(OPEN2-25731-nx12-upgrade) npm i
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated debug@4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)

> core-js@3.15.1 postinstall /Users/benjamin.charity/code/apiture/web/node_modules/@angular-devkit/build-angular/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon:
> https://opencollective.com/core-js
> https://www.patreon.com/zloirock

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> @angular/cli@12.1.0 postinstall /Users/benjamin.charity/code/apiture/web/node_modules/@angular/cli
> node ./bin/postinstall/script.js


> apiture-web@0.2.278 postinstall /Users/benjamin.charity/code/apiture/web
> ngcc  --create-ivy-entry-points --properties es2015 browser module main && husky install && nx package postcss-themes --skip-nx-cache && npm run build:schema:all

Compiling @angular/animations : es2015 as esm2015
Compiling @angular/cdk/keycodes : es2015 as esm2015
Compiling @angular/compiler/testing : es2015 as esm2015
Compiling @angular/core : es2015 as esm2015
Compiling @angular/service-worker/config : es2015 as esm2015
Compiling @nrwl/angular/testing : es2015 as esm2015
Compiling angular2-fontawesome : module as esm5
Compiling @angular/animations : main as umd
Compiling @angular/cdk/keycodes : main as umd
Compiling @angular/service-worker/config : main as umd
Compiling @angular/compiler/testing : main as umd
Compiling angular2-fontawesome : main as commonjs
Compiling @nrwl/angular/testing : main as umd
Error: Error on worker #1: TypeError: compiler_1.createR3ProviderExpression is not a function
    at extractInjectableMetadata (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/injectable.js:140:40)
    at InjectableDecoratorHandler.analyze (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/annotations/src/injectable.js:70:24)
    at NgccTraitCompiler.TraitCompiler.analyzeTrait (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:397:40)
    at analyze (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:347:58)
    at _loop_1 (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:369:21)
    at NgccTraitCompiler.TraitCompiler.analyzeClass (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/src/ngtsc/transform/src/compilation.js:375:35)
    at NgccTraitCompiler.analyzeFile (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/analysis/ngcc_trait_compiler.js:49:26)
    at DecorationAnalyzer.analyzeProgram (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/analysis/decoration_analyzer.js:150:39)
    at Transformer.analyzeProgram (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/packages/transformer.js:135:57)
    at Transformer.transform (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/packages/transformer.js:77:27)
    at ClusterMaster.onWorkerMessage (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:195:27)
    at /Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:55:95
    at ClusterMaster.<anonymous> (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:293:57)
    at step (/Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:143:27)
    at Object.next (/Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:124:57)
    at /Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/benjamin.charity/code/apiture/web/node_modules/tslib/tslib.js:113:16)
    at EventEmitter.<anonymous> (/Users/benjamin.charity/code/apiture/web/node_modules/@angular/compiler-cli/ngcc/src/execution/cluster/master.js:287:32)
    at EventEmitter.emit (events.js:315:20)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! apiture-web@0.2.278 postinstall: `ngcc  --create-ivy-entry-points --properties es2015 browser module main && husky install && nx package postcss-themes --skip-nx-cache && npm run build:schema:all`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the apiture-web@0.2.278 postinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/benjamin.charity/.npm/_logs/2021-07-01T15_22_45_953Z-debug.log

And here is my updated report at this point:

  Node : 12.18.3
  OS   : darwin x64
  npm  : 6.14.6

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

@ivanji
Copy link

ivanji commented Jul 5, 2021

I attempted upgrading from 12.0.8 to 12.5.5

╰─ nx migrate latest                                                                                                                                         ─╯
Fetching meta data about packages.
It may take a few minutes.
Fetching @nrwl/workspace@latest
Fetching prettier@^2.3.1
Fetching @nrwl/cli@12.5.5
Fetching @nrwl/cypress@12.5.5
Fetching @nrwl/eslint-plugin-nx@12.5.5
Fetching @nrwl/jest@12.5.5
Fetching @nrwl/linter@12.5.5
Fetching @nrwl/next@12.5.5
Fetching @nrwl/react@12.5.5
Fetching @nrwl/storybook@12.5.5
Fetching @nrwl/tao@12.5.5
Fetching @nrwl/web@12.5.5
Fetching ts-jest@27.0.3
Fetching jest@27.0.3
Fetching next@10.2.0
Fetching @nrwl/workspace@12.5.5
Fetching prettier@2.3.2

then yarn

Reviewed all packages under node_modules/@nrwl and they seem updated to 12.5.5

Continue with

nx migrate --run-migrations --verbose

 NX   NOTE  Target dependencies have been updated in nx.json

  Nx has deprecated strictlyOrderedTargets in favour of targetDependencies.
  Based on your configuration the migration has configured targetDependencies for the following targets: build.
  Read more here: https://nx.dev/core-concepts/configuration

Successfully finished add-target-dependencies
---------------------------------------------------------
Running migration update-jest-preset-angular-8-4-0
Successfully finished update-jest-preset-angular-8-4-0
---------------------------------------------------------
Running migration update-ts-jest-6-5-5
Successfully finished update-ts-jest-6-5-5
---------------------------------------------------------
Running migration support-jest-27
Successfully finished support-jest-27
---------------------------------------------------------
Running migration update-ts-jest-and-jest-preset-angular
Successfully finished update-ts-jest-and-jest-preset-angular
---------------------------------------------------------
Running migration remove-eslint-project-config-if-no-type-checking-rules
Successfully finished remove-eslint-project-config-if-no-type-checking-rules
---------------------------------------------------------
Running migration update-12-1-0
components: no storybook configured. skipping migration...
context: no storybook configured. skipping migration...
app-1: no storybook configured. skipping migration...
app-1-e2e: no storybook configured. skipping migration...
hooks: no storybook configured. skipping migration...
icons: no storybook configured. skipping migration...
layouts: no storybook configured. skipping migration...

Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at /Users/omitted/agencyx/nx-app/node_modules/@nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js:16:46
    at Map.forEach (<anonymous>)
    at /Users/omitted/agencyx/nx-app/node_modules/@nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js:10:18
    at Generator.next (<anonymous>)
    at /Users/omitted/agencyx/nx-app/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/omitted/agencyx/nx-app/node_modules/tslib/tslib.js:113:16)
    at updateStorybookTsconfig (/Users/omitted/agencyx/nx-app/node_modules/@nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js:7:20)
    at /private/var/folders/l5/6c5qhf8n699b36dyws0hc3wm0000gn/T/tmp-45400-16FgZhTq5xfZ/node_modules/@nrwl/tao/src/commands/migrate.js:533:15
/Users/omitted/agencyx/nx-app/node_modules/@nrwl/workspace/node_modules/yargs/build/lib/yargs.js:1132
                throw err;
                ^

Error: Command failed: /var/folders/l5/6c5qhf8n699b36dyws0hc3wm0000gn/T/tmp-45400-16FgZhTq5xfZ/node_modules/.bin/tao migrate --run-migrations --verbose
    at checkExecSyncError (child_process.js:616:11)
    at Object.execSync (child_process.js:652:15)
    at Object.handler (/Users/omitted/agencyx/nx-app/node_modules/@nrwl/workspace/src/command-line/nx-commands.js:89:25)
    at Object.runCommand (/Users/omitted/agencyx/nx-app/node_modules/@nrwl/workspace/node_modules/yargs/build/lib/command.js:196:48)
    at Object.parseArgs [as _parseArgs] (/Users/omitted/agencyx/nx-app/node_modules/@nrwl/workspace/node_modules/yargs/build/lib/yargs.js:1043:55)
    at Object.get [as argv] (/Users/omitted/agencyx/nx-app/node_modules/@nrwl/workspace/node_modules/yargs/build/lib/yargs.js:986:25)
    at Object.initLocal (/Users/omitted/agencyx/nx-app/node_modules/@nrwl/cli/lib/init-local.js:25:79)
    at Object.<anonymous> (/Users/omitted/agencyx/nx-app/node_modules/@nrwl/cli/bin/nx.js:43:18)
    at Module._compile (/Users/ivanji/.nvm/versions/node/v14.16.0/lib/node_modules/nx/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10) {
  status: 1,
  signal: null,
  output: [ null, null, null ],
  pid: 45402,
  stdout: null,
  stderr: null
}

Apart from the above error, I'm wondering the following:
Running migration update-12-1-0 - shouldn't this be an upgrade to 12.5.5?

@ivanji
Copy link

ivanji commented Jul 5, 2021

I also tried upgrading from 12.0.8 to 12.1.0 and didn't have any luck. So I've tried latest and 12.1.0 and neither worked.

Node : 14.16.0
  OS   : darwin x64
  yarn : 1.22.10
  
  nx : Not Found. 
  @nrwl/angular : Not Found
  @nrwl/cli : 12.0.8
  @nrwl/cypress : 12.0.8
  @nrwl/devkit : 12.0.8
  @nrwl/eslint-plugin-nx : 12.0.8
  @nrwl/express : Not Found
  @nrwl/jest : 12.0.8
  @nrwl/linter : 12.0.8
  @nrwl/nest : Not Found
  @nrwl/next : 12.0.8
  @nrwl/node : Not Found
  @nrwl/react : 12.0.8
  @nrwl/schematics : Not Found
  @nrwl/tao : 12.0.8
  @nrwl/web : 12.0.8
  @nrwl/workspace : 12.0.8
  @nrwl/storybook : 12.0.8
  @nrwl/gatsby : Not Found
  typescript : 4.1.5

@mandarini
Copy link
Member

mandarini commented Jul 16, 2021

@ivanji

Running migration update-12-1-0 - shouldn't this be an upgrade to 12.5.5?

The migrator will run all migrations from the version you are to the target version, one by one. So it's expected.

@mandarini
Copy link
Member

@ivanji @benjamincharity

Hi both. Thanks for reporting on this issue.

I notice that your error is found into the @nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js file.

TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at /Users/omitted/agencyx/nx-app/node_modules/@nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js:16:46
    at Map.forEach (<anonymous>)
    at /Users/omitted/agencyx/nx-app/node_modules/@nrwl/storybook/src/migrations/update-12-1-0/fix-storybook-tsconfig.js:10:18
    at Generator.next (<anonymous>)

Looking into this file (in the node_modules, yes), I can see that the error is on this line:

 const storybookExecutor = Object.keys(targets).find((x) => targets[x].executor === '@nrwl/storybook:storybook');

Let's see what the targets object is:
Line 12 of the same file:

const targets = projectConfig.targets;

From that, I can assume that your project in your workspace.json (or angular.json) has no targets defined. Normally, a project in an Nx workspace has targets defined, at least for building, running, testing, the default ones, that is. So this is why this migrator does not take into account projects with no targets defined.

I can push a fix to account for that niche use case, though! :)

@ivanji
Copy link

ivanji commented Jul 16, 2021

Hi @mandarini - thanks for looking into this.

I can see a target object for each of my apps and libs. Does the main project also require a target?

@mandarini
Copy link
Member

HI @ivanji !

Which would the "main" project be? Can I see your workspace.json please?

@ivanji
Copy link

ivanji commented Jul 16, 2021

Sure!


{
  "version": 2,
  "cli": {
    "defaultCollection": "@nrwl/react"
  },
  "generators": {
    "@nrwl/react": {
      "application": {
        "style": "scss",
        "linter": "eslint",
        "babel": true
      },
      "component": {
        "style": "scss"
      },
      "library": {
        "style": "scss",
        "linter": "eslint"
      }
    },
    "@nrwl/next": {
      "application": {
        "style": "scss",
        "linter": "eslint"
      }
    }
  },
  "projects": {
    "components": {
      "root": "libs/components",
      "sourceRoot": "libs/components/src",
      "projectType": "library",
      "targets": {
        "build": {
          "executor": "@nrwl/web:package",
          "outputs": ["{options.outputPath}"],
          "options": {
            "outputPath": "dist/libs/components",
            "tsConfig": "libs/components/tsconfig.lib.json",
            "project": "libs/components/package.json",
            "entryFile": "libs/components/src/index.js",
            "external": ["react", "react-dom"],
            "rollupConfig": "@nrwl/react/plugins/bundle-rollup",
            "assets": [
              {
                "glob": "libs/components/README.md",
                "input": ".",
                "output": "."
              }
            ]
          }
        },
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["libs/components/**/*.{ts,tsx,js,jsx}"]
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/libs/components"],
          "options": {
            "jestConfig": "libs/components/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "context": {
      "root": "libs/context",
      "sourceRoot": "libs/context/src",
      "projectType": "library",
      "targets": {
        "build": {
          "executor": "@nrwl/web:package",
          "outputs": ["{options.outputPath}"],
          "options": {
            "outputPath": "dist/libs/context",
            "tsConfig": "libs/context/tsconfig.lib.json",
            "project": "libs/context/package.json",
            "entryFile": "libs/context/src/index.js",
            "external": ["react", "react-dom"],
            "rollupConfig": "@nrwl/react/plugins/bundle-rollup",
            "assets": [
              {
                "glob": "libs/context/README.md",
                "input": ".",
                "output": "."
              }
            ]
          }
        },
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["libs/context/**/*.{ts,tsx,js,jsx}"]
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/libs/context"],
          "options": {
            "jestConfig": "libs/context/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "data-access/slices-listings": {
      "root": "libs/data-access/slices/listings",
      "sourceRoot": "libs/data-access/slices/listings/src",
      "projectType": "library",
      "targets": {
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": [
              "libs/data-access/slices/listings/**/*.{ts,tsx,js,jsx}"
            ]
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/libs/data-access/slices/listings"],
          "options": {
            "jestConfig": "libs/data-access/slices/listings/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "exclusive-agency": {
      "root": "apps/exclusive-agency",
      "sourceRoot": "apps/exclusive-agency",
      "projectType": "application",
      "targets": {
        "build": {
          "executor": "@nrwl/next:build",
          "outputs": ["{options.outputPath}"],
          "options": {
            "root": "apps/exclusive-agency",
            "outputPath": "dist/apps/exclusive-agency"
          },
          "configurations": {
            "production": {}
          }
        },
        "serve": {
          "executor": "@nrwl/next:server",
          "options": {
            "buildTarget": "exclusive-agency:build",
            "dev": true
          },
          "configurations": {
            "production": {
              "buildTarget": "exclusive-agency:build:production",
              "dev": false
            }
          }
        },
        "export": {
          "executor": "@nrwl/next:export",
          "options": {
            "buildTarget": "exclusive-agency:build:production"
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/apps/exclusive-agency"],
          "options": {
            "jestConfig": "apps/exclusive-agency/jest.config.js",
            "passWithNoTests": true
          }
        },
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["apps/exclusive-agency/**/*.{ts,tsx,js,jsx}"]
          }
        }
      }
    },
    "exclusive-agency-e2e": {
      "root": "apps/exclusive-agency-e2e",
      "sourceRoot": "apps/exclusive-agency-e2e/src",
      "projectType": "application",
      "targets": {
        "e2e": {
          "executor": "@nrwl/cypress:cypress",
          "options": {
            "cypressConfig": "apps/exclusive-agency-e2e/cypress.json",
            "tsConfig": "apps/exclusive-agency-e2e/tsconfig.e2e.json",
            "devServerTarget": "exclusive-agency:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "exclusive-agency:serve:production"
            }
          }
        },
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["apps/exclusive-agency-e2e/**/*.js"]
          }
        }
      }
    },
    "features-featured-listings": {
      "root": "libs/features/featured-listings",
      "sourceRoot": "libs/features/featured-listings/src",
      "projectType": "library",
      "targets": {
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": [
              "libs/features/featured-listings/**/*.{ts,tsx,js,jsx}"
            ]
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/libs/features/featured-listings"],
          "options": {
            "jestConfig": "libs/features/featured-listings/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "features-listing-channels": {
      "root": "libs/features/listing-channels",
      "sourceRoot": "libs/features/listing-channels/src",
      "projectType": "library",
      "targets": {
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": [
              "libs/features/listing-channels/**/*.{ts,tsx,js,jsx}"
            ]
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/libs/features/listing-channels"],
          "options": {
            "jestConfig": "libs/features/listing-channels/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "hooks": {
      "root": "libs/hooks",
      "sourceRoot": "libs/hooks/src",
      "projectType": "library",
      "targets": {
        "build": {
          "executor": "@nrwl/web:package",
          "outputs": ["{options.outputPath}"],
          "options": {
            "outputPath": "dist/libs/hooks",
            "tsConfig": "libs/hooks/tsconfig.lib.json",
            "project": "libs/hooks/package.json",
            "entryFile": "libs/hooks/src/index.js",
            "external": ["react", "react-dom"],
            "rollupConfig": "@nrwl/react/plugins/bundle-rollup",
            "assets": [
              {
                "glob": "libs/hooks/README.md",
                "input": ".",
                "output": "."
              }
            ]
          }
        },
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["libs/hooks/**/*.{ts,tsx,js,jsx}"]
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/libs/hooks"],
          "options": {
            "jestConfig": "libs/hooks/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "icons": {
      "root": "libs/icons",
      "sourceRoot": "libs/icons/src",
      "projectType": "library",
      "targets": {
        "build": {
          "executor": "@nrwl/web:package",
          "outputs": ["{options.outputPath}"],
          "options": {
            "outputPath": "dist/libs/icons",
            "tsConfig": "libs/icons/tsconfig.lib.json",
            "project": "libs/icons/package.json",
            "entryFile": "libs/icons/src/index.js",
            "external": ["react", "react-dom"],
            "rollupConfig": "@nrwl/react/plugins/bundle-rollup",
            "assets": [
              {
                "glob": "libs/icons/README.md",
                "input": ".",
                "output": "."
              }
            ]
          }
        },
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["libs/icons/**/*.{ts,tsx,js,jsx}"]
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/libs/icons"],
          "options": {
            "jestConfig": "libs/icons/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "layouts": {
      "root": "libs/layouts",
      "sourceRoot": "libs/layouts/src",
      "projectType": "library",
      "targets": {
        "build": {
          "executor": "@nrwl/web:package",
          "outputs": ["{options.outputPath}"],
          "options": {
            "outputPath": "dist/libs/layouts",
            "tsConfig": "libs/layouts/tsconfig.lib.json",
            "project": "libs/layouts/package.json",
            "entryFile": "libs/layouts/src/index.js",
            "external": ["react", "react-dom"],
            "rollupConfig": "@nrwl/react/plugins/bundle-rollup",
            "assets": [
              {
                "glob": "libs/layouts/README.md",
                "input": ".",
                "output": "."
              }
            ]
          }
        },
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["libs/layouts/**/*.{ts,tsx,js,jsx}"]
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/libs/layouts"],
          "options": {
            "jestConfig": "libs/layouts/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "shared-styles": {
      "root": "libs/styles",
      "sourceRoot": "libs/styles",
      "projectType": "library"
    },
    "tasker": {
      "root": "apps/tasker",
      "sourceRoot": "apps/tasker",
      "projectType": "application",
      "targets": {
        "build": {
          "executor": "@nrwl/next:build",
          "outputs": ["{options.outputPath}"],
          "options": {
            "root": "apps/tasker",
            "outputPath": "dist/apps/tasker"
          },
          "configurations": {
            "production": {}
          }
        },
        "serve": {
          "executor": "@nrwl/next:server",
          "options": {
            "buildTarget": "tasker:build",
            "dev": true
          },
          "configurations": {
            "production": {
              "buildTarget": "tasker:build:production",
              "dev": false
            }
          }
        },
        "export": {
          "executor": "@nrwl/next:export",
          "options": {
            "buildTarget": "tasker:build:production"
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/apps/tasker"],
          "options": {
            "jestConfig": "apps/tasker/jest.config.js",
            "passWithNoTests": true
          }
        },
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["apps/tasker/**/*.{ts,tsx,js,jsx}"]
          }
        }
      }
    },
    "tasker-e2e": {
      "root": "apps/tasker-e2e",
      "sourceRoot": "apps/tasker-e2e/src",
      "projectType": "application",
      "targets": {
        "e2e": {
          "executor": "@nrwl/cypress:cypress",
          "options": {
            "cypressConfig": "apps/tasker-e2e/cypress.json",
            "tsConfig": "apps/tasker-e2e/tsconfig.e2e.json",
            "devServerTarget": "tasker:serve"
          },
          "configurations": {
            "production": {
              "devServerTarget": "tasker:serve:production"
            }
          }
        },
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["apps/tasker-e2e/**/*.js"]
          }
        }
      }
    },
    "utils": {
      "root": "libs/utils/",
      "sourceRoot": "libs/utils/",
      "projectType": "library",
      "targets": {
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["libs/utils/**/*.{ts,tsx,js,jsx}"]
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/libs/utils"],
          "options": {
            "jestConfig": "libs/utils/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    },
    "utils-constants": {
      "root": "libs/utils/constants",
      "sourceRoot": "libs/utils/constants/src",
      "projectType": "library",
      "targets": {
        "build": {
          "executor": "@nrwl/web:package",
          "outputs": ["{options.outputPath}"],
          "options": {
            "outputPath": "dist/libs/utils/constants",
            "tsConfig": "libs/utils/constants/tsconfig.lib.json",
            "project": "libs/utils/constants/package.json",
            "entryFile": "libs/utils/constants/src/index.js",
            "external": ["react", "react-dom"],
            "rollupConfig": "@nrwl/react/plugins/bundle-rollup",
            "assets": [
              {
                "glob": "libs/utils/constants/README.md",
                "input": ".",
                "output": "."
              }
            ]
          }
        },
        "lint": {
          "executor": "@nrwl/linter:eslint",
          "options": {
            "lintFilePatterns": ["libs/utils/constants/**/*.{ts,tsx,js,jsx}"]
          }
        },
        "test": {
          "executor": "@nrwl/jest:jest",
          "outputs": ["coverage/libs/utils/constants"],
          "options": {
            "jestConfig": "libs/utils/constants/jest.config.js",
            "passWithNoTests": true
          }
        }
      }
    }
  }
}

@mandarini
Copy link
Member

I see

    "shared-styles": {
      "root": "libs/styles",
      "sourceRoot": "libs/styles",
      "projectType": "library"
    },

has no targets. Maybe that's triggering the error?

@ivanji
Copy link

ivanji commented Jul 17, 2021

You're right - when I removed this library from the workspace, updating to the latest version worked! But how am I supposed to have stylesheets only libraries in my project which don't need targets? Probably, adding a fix for this like you suggested for this type of situations would help. Or could you suggest an alternative? Thanks!

@github-actions
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 Mar 23, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated scope: storybook Issues related to Storybook support in Nx type: bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants