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

Cannot migrate to v14.2.1 #10628

Closed
semoonpark opened this issue Jun 8, 2022 · 9 comments · Fixed by #10638
Closed

Cannot migrate to v14.2.1 #10628

semoonpark opened this issue Jun 8, 2022 · 9 comments · Fixed by #10638

Comments

@semoonpark
Copy link

Current Behavior

Tried to migrate version 14.2.1 but failed.

Running migration 14-2-0-remove-default-collection
Cannot convert undefined or null to object
TypeError: Cannot convert undefined or null to object
    at Function.keys (<anonymous>)
    at /Users/semoonpark/work/damoa-customer-web/node_modules/nx/src/migrations/update-14-2-0/remove-default-collection.js:11:20
    at Generator.next (<anonymous>)
    at /Users/semoonpark/work/damoa-customer-web/node_modules/tslib/tslib.js:117:75
    at new Promise (<anonymous>)
    at Object.__awaiter (/Users/semoonpark/work/damoa-customer-web/node_modules/tslib/tslib.js:113:16)
    at default_1 (/Users/semoonpark/work/damoa-customer-web/node_modules/nx/src/migrations/update-14-2-0/remove-default-collection.js:8:20)
    at /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-61169-toqcnAq5ZIVE/node_modules/nx/src/command-line/migrate.js:719:15
    at Generator.next (<anonymous>)
    at /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-61169-toqcnAq5ZIVE/node_modules/tslib/tslib.js:118:75
Command failed: /var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-61169-toqcnAq5ZIVE/node_modules/.bin/nx _migrate --run-migrations --verbose

What is the 14-2-0-remove-default-collection job?

Expected Behavior

Steps to Reproduce

This issue may not be prioritized if details are not provided to help us reproduce the issue.

Failure Logs

Environment

@semoonpark
Copy link
Author

also got another error

Running migration update-external-emotion-jsx-runtime-14.1.0
Cannot find module '@angular-devkit/core'
Require stack:
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/nx/src/adapter/ngcli-adapter.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/nx/src/command-line/migrate.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/nx/src/command-line/nx-commands.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/nx/bin/init-local.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/nx/bin/nx.js
Error: Cannot find module '@angular-devkit/core'
Require stack:
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/nx/src/adapter/ngcli-adapter.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/nx/src/command-line/migrate.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/nx/src/command-line/nx-commands.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/nx/bin/init-local.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/nx/bin/nx.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
    at Function.Module._load (internal/modules/cjs/loader.js:745:27)
    at Module.require (internal/modules/cjs/loader.js:961:19)
    at require (internal/modules/cjs/helpers.js:92:18)
    at Object.<anonymous> (/private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/nx/src/adapter/ngcli-adapter.js:6:16)
    at Module._compile (internal/modules/cjs/loader.js:1072:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1101:10)
    at Module.load (internal/modules/cjs/loader.js:937:32)
    at Function.Module._load (internal/modules/cjs/loader.js:778:12)
    at Module.require (internal/modules/cjs/loader.js:961:19)
Command failed: /var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-91568-DQKpcd24Kppt/node_modules/.bin/nx _migrate --run-migrations --verbose

@cre8
Copy link

cre8 commented Jun 8, 2022

Getting the same error when using a minimal angular project and then trying to update it:

Running migration migration-entry-components
Cannot find module '@angular-devkit/core'
Require stack:
- /root/.nvm/versions/node/v16.14.0/lib/node_modules/nx/src/commands/ngcli-adapter.js
- /root/.nvm/versions/node/v16.14.0/lib/node_modules/nx/src/commands/migrate.js
- /root/.nvm/versions/node/v16.14.0/lib/node_modules/nx/src/cli/index.js
- /root/.nvm/versions/node/v16.14.0/lib/node_modules/nx/bin/nx.js

@e-oz
Copy link

e-oz commented Jun 8, 2022

What is the 14-2-0-remove-default-collection job?

It removed

"defaultCollection": "@nrwl/angular",

line from my nx.json
Screenshot 2022-06-08 at 11 00 16

@leosvelperez leosvelperez added the scope: misc Misc issues label Jun 8, 2022
@leosvelperez
Copy link
Member

Thanks for reporting this!

@semoonpark looking at the migration source code, the issue seems to be that you don't have a cli entry in your nx.json file. That's not an issue on your side, it's an issue with the migration. I'll push a fix for that. You can remove that migration from the migrations.json file since it won't apply to your workspace.

Regarding the Cannot find module '@angular-devkit/core', could you please provide the output of nx report?

@leosvelperez
Copy link
Member

I merged a fix for the error with the 14-2-0-remove-default-collection migration #10632.

Can someone provide a repo where the Cannot find module '@angular-devkit/core' error can be reproduced?

@cre8
Copy link

cre8 commented Jun 8, 2022

@semoonpark
Copy link
Author

Sure, @leosvelperez .

>  NX  Running migrations from 'migrations.json'

Running migration 14-0-6-remove-root
Successfully finished 14-0-6-remove-root
---------------------------------------------------------
Running migration 14-2-0-add-json-schema
Successfully finished 14-2-0-add-json-schema
---------------------------------------------------------
Running migration 14-2-0-replace-relative-outputs-with-absolute
Successfully finished 14-2-0-replace-relative-outputs-with-absolute
---------------------------------------------------------
Running migration 14-0-0-change-nx-json-presets
Successfully finished 14-0-0-change-nx-json-presets
---------------------------------------------------------
Running migration 14-0-0-change-npm-script-executor
Successfully finished 14-0-0-change-npm-script-executor
---------------------------------------------------------
Running migration 14-2-0-enable-source-analysis
Successfully finished 14-2-0-enable-source-analysis
---------------------------------------------------------
Running migration update-react-dom-render-14.0.0
Successfully finished update-react-dom-render-14.0.0
---------------------------------------------------------
Running migration replace-testing-library-react-hook-14.0.0
Successfully finished replace-testing-library-react-hook-14.0.0
---------------------------------------------------------
Running migration add-default-development-configurations-14.0.0
Successfully finished add-default-development-configurations-14.0.0
---------------------------------------------------------
Running migration update-external-emotion-jsx-runtime-14.1.0
Cannot find module '@angular-devkit/core'
Require stack:
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-52541-Ew4Rf0kDcoGJ/node_modules/nx/src/adapter/ngcli-adapter.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-52541-Ew4Rf0kDcoGJ/node_modules/nx/src/command-line/migrate.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-52541-Ew4Rf0kDcoGJ/node_modules/nx/src/command-line/nx-commands.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-52541-Ew4Rf0kDcoGJ/node_modules/nx/bin/init-local.js
- /private/var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-52541-Ew4Rf0kDcoGJ/node_modules/nx/bin/nx.js
Command failed: /var/folders/fb/1g498tms6wx4b6j5rdf78zk40000gn/T/tmp-52541-Ew4Rf0kDcoGJ/node_modules/.bin/nx _migrate --run-migrations

Here's the result of nx report

> nx report

 >  NX   Report complete - copy this into the issue template

   Node : 14.17.5
   OS   : darwin x64
   yarn : 1.22.11
   
   nx : 14.2.1
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.2.1
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.2.1
   @nrwl/eslint-plugin-nx : 14.2.1
   @nrwl/express : Not Found
   @nrwl/jest : 14.2.1
   @nrwl/js : 14.2.1
   @nrwl/linter : 14.2.1
   @nrwl/nest : Not Found
   @nrwl/next : 14.2.1
   @nrwl/node : Not Found
   @nrwl/nx-cloud : 14.0.8
   @nrwl/nx-plugin : Not Found
   @nrwl/react : 14.2.1
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : 14.2.1
   @nrwl/web : 14.2.1
   @nrwl/workspace : 14.2.1
   typescript : 4.5.3
   ---------------------------------------
   Community plugins:
         rxjs: 6.6.7

@leosvelperez
Copy link
Member

@semoonpark thanks for the details. I've reproduced the issue and pushed a fix for it. To unblock yourself, you can locate the update-external-emotion-jsx-runtime-14.1.0 entry in the migrations.json file and add the "cli": "nx" to it:

{
  "migrations": [
    ...
    {
      "version": "14.1.0-beta.0",
      "description": "Update external option in projects for Emotion",
      "factory": "./src/migrations/update-14-1-0/update-external-emotion-jsx-runtime",
      "package": "@nrwl/react",
      "name": "update-external-emotion-jsx-runtime-14.1.0",
      "cli": "nx"
    },
    ...
  ]
}

@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 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants