question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Cannot convert undefined or null to object

See original GitHub issue

Current Behavior

I am currently on 12.10.0 version. When I run nx migrate @nrwl/workspace@13.1.4 --verbose command I am getting an error.

package.json

“dependencies”: { “@angular/animations”: “^12.2.0”, “@angular/cdk”: “^12.2.0”, “@angular/common”: “^12.2.0”, “@angular/compiler”: “^12.2.0”, “@angular/core”: “^12.2.0”, “@angular/forms”: “^12.2.0”, “@angular/localize”: “^12.2.9”, “@angular/platform-browser”: “^12.2.0”, “@angular/platform-browser-dynamic”: “^12.2.0”, “@angular/router”: “^12.2.0”, “@nrwl/angular”: “^12.10.1”, “fs-extra”: “^10.0.0”, “http-status-codes”: “^2.1.4”, “keycloak-angular”: “^7.3.1”, “keycloak-js”: “^9.0.3”, “lodash.sortby”: “^4.7.0”, “minimist”: “^1.2.5”, “moment”: “^2.24.0”, “moment-timezone”: “^0.5.27”, “ngx-hotjar”: “0.0.5”, “node-fetch”: “^2.6.1”, “primeng”: “^9.1.0”, “rxjs”: “^6.5.4”, “tslib”: “^2.0.0”, “uuid”: “^8.3.2”, “zone.js”: “~0.11.4” }, “devDependencies”: { “@angular-devkit/build-angular”: “12.2.15”, “@angular-eslint/eslint-plugin”: “~12.3.0”, “@angular-eslint/eslint-plugin-template”: “~12.3.0”, “@angular-eslint/template-parser”: “~12.3.0”, “@angular/cli”: “12.2.15”, “@angular/compiler-cli”: “12.2.0”, “@angular/language-service”: “12.2.0”, “@nrwl/cli”: “^12.10.1”, “@nrwl/cypress”: “^12.10.1”, “@nrwl/eslint-plugin-nx”: “^12.10.1”, “@nrwl/jest”: “^12.10.1”, “@nrwl/linter”: “^12.10.1”, “@nrwl/tao”: “^12.10.1”, “@nrwl/workspace”: “^12.10.1”, “@types/jest”: “27.0.2”, “@types/node”: “14.14.33”, “@typescript-eslint/eslint-plugin”: “4.31.2”, “@typescript-eslint/parser”: “4.31.2”, “cypress”: “^9.5.1”, “cypress-grep”: “^2.10.1”, “cypress-keycloak-commands”: “^1.2.0”, “cypress-multi-reporters”: “^1.6.0”, “eslint”: “7.32.0”, “eslint-config-prettier”: “8.1.0”, “eslint-plugin-cypress”: “^2.10.3”, “husky”: “^7.0.4”, “jest”: “27.2.3”, “jest-junit”: “^13.0.0”, “jest-preset-angular”: “10.0.1”, “json-server”: “^0.16.1”, “lint-staged”: “^12.1.2”, “mocha”: “^9.2.2”, “mocha-junit-reporter”: “^2.0.2”, “ng-mocks”: “^10.1.2”, “ng-packagr”: “^9.0.0”, “npm”: “~6.14.16”, “postcss”: “^8.3.9”, “postcss-import”: “^14.0.2”, “postcss-preset-env”: “^6.7.0”, “postcss-url”: “^10.1.1”, “prettier”: “^2.3.1”, “sonar-scanner”: “^3.1.0”, “ts-jest”: “27.0.5”, “typescript”: “4.3.5” }

ERROR The migrate command failed.

Cannot convert undefined or null to object TypeError: Cannot convert undefined or null to object at Function.values (<anonymous>) at C:\Users\AppData\Local\Temp\tmp-161692-6Qql83Kb3MgY\node_modules\nx\src\command-line\connect-to-nx-cloud.js:38:36 at Generator.next (<anonymous>) at C:\Users\AppData\Local\Temp\tmp-161692-6Qql83Kb3MgY\node_modules\nx\node_modules\tslib\tslib.js:118:75 at new Promise (<anonymous>) at Object.__awaiter (C:\Users\AppData\Local\Temp\tmp-161692-6Qql83Kb3MgY\node_modules\nx\node_modules\tslib\tslib.js:114:16) at connectToNxCloudCommand (C:\Users\AppData\Local\Temp\tmp-161692-6Qql83Kb3MgY\node_modules\nx\src\command-line\connect-to-nx-cloud.js:36:20) at C:\Users\AppData\Local\Temp\tmp-161692-6Qql83Kb3MgY\node_modules\nx\src\command-line\migrate.js:560:73 at Generator.next (<anonymous>) at fulfilled (C:\Users\AppData\Local\Temp\tmp-161692-6Qql83Kb3MgY\node_modules\nx\node_modules\tslib\tslib.js:115:62)

Expected Behavior

Expect the migration to the newer version work as expected.

Steps to Reproduce

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

Failure Logs

Environment

Issue Analytics

  • State:open
  • Created a year ago
  • Reactions:1
  • Comments:5

github_iconTop GitHub Comments

1reaction
ahinnicommented, May 5, 2022

I have no idea other than to try {} instead of all of the stuff I put in. ie. tasksRunnerOptions: {}… or figure out what that default task runner is, and how to install it.

1reaction
ahinnicommented, May 4, 2022

I had the same error using 12.10.0. This is the line that it is failing on:

const nxCloudUsed = Object.values(nxJson.tasksRunnerOptions).find((r) => r.runner == '@nrwl/nx-cloud');

I took a look at my nx.json file, and it didn’t have a taskRunnerOptions setting in it. I created a brand new workspace and copied what was in there and was able to get past this error.

This is what I added to my nx.json

"tasksRunnerOptions": {
    "default": {
      "runner": "nx/tasks-runners/default",
      "options": {
        "cacheableOperations": ["build", "lint", "test", "e2e"]
      }
    }
  },
Read more comments on GitHub >

github_iconTop Results From Across the Web

Cannot convert undefined or null to object - Stack Overflow
Generic answer. This error is caused when you call a function that expects an Object as its argument, but pass undefined or null...
Read more >
Cannot convert undefined or null to Object in JavaScript
The "Cannot convert undefined or null to Object" error occurs when we pass a null or an undefined value to a function that...
Read more >
Object.keys(null) possible - cannot convert undefined or null to ...
Conditions above this line allow msg===null to get into Object.keys(msg);. livedata_connection.js:1626 Uncaught TypeError: Cannot convert ...
Read more >
Cannot convert undefined or null to object - JavaScript
JavaScript : How to resolve TypeError: Cannot convert undefined or null to object [ Gift : Animated Search Engine ...
Read more >
Edit Profile script issue: Cannot convert undefined or null to ...
[This thread is closed.] Hi there, I'm getting this error Cannot convert undefined or null to object when editing profile using the…
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found