nrwl / nx

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

' NX tasksRunner is not a function' Error on all nx commands after upgrade #22201

Closed gclapham closed 6 months ago

gclapham commented 6 months ago

Current Behavior

Invoking any nx command, eg npx nx run my-app-name:serve:development results in

 NX   tasksRunner is not a function

TypeError: tasksRunner is not a function
    at invokeTasksRunner (/Users/grahamclapham/Documents/CLIENT/M_S/offer-setup-tool-ui/node_modules/nx/src/tasks-runner/run-command.js:127:33)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /Users/grahamclapham/Documents/CLIENT/M_S/offer-setup-tool-ui/node_modules/nx/src/tasks-runner/run-command.js:89:24
    at async handleErrors (/Users/grahamclapham/Documents/CLIENT/M_S/offer-setup-tool-ui/node_modules/nx/src/utils/params.js:9:16)
    at async runCommand (/Users/grahamclapham/Documents/CLIENT/M_S/offer-setup-tool-ui/node_modules/nx/src/tasks-runner/run-command.js:83:20)
    at async Object.runOne (/Users/grahamclapham/Documents/CLIENT/M_S/offer-setup-tool-ui/node_modules/nx/src/command-line/run/run-one.js:50:24)

I created a fresh nx repo and copied the project files over to it – this runs but gives me separate issues with migrating Angular and not being in sync with GitHub.

Expected Behavior

It should run nx commands from the nx panel in VsCode and the terminal.

GitHub Repo

can't send for security reasons

Steps to Reproduce

  1. run any nx command – run, build, lint, etc – gives ' NX tasksRunner is not a function' Error

Nx Report

Node   : 18.19.1
OS     : darwin-arm64
yarn   : 1.22.21

nx (global)        : 18.0.7
nx                 : 18.1.0
@nx/js             : 18.1.0
@nx/jest           : 18.1.0
@nx/linter         : 18.1.0
@nx/eslint         : 18.1.0
@nx/workspace      : 18.1.0
@nx/angular        : 18.1.0
@nx/cypress        : 18.1.0
@nx/devkit         : 18.1.0
@nx/eslint-plugin  : 18.1.0
@nrwl/tao          : 18.1.0
@nx/web            : 18.1.0
@nx/webpack        : 18.1.0
typescript         : 4.3.5
---------------------------------------
Community plugins:
@ng-bootstrap/ng-bootstrap : 10.0.0
@ngrx/component-store      : 14.3.3
@ngrx/effects              : 14.3.3
@ngrx/entity               : 14.3.3
@ngrx/router-store         : 14.3.3
@ngrx/schematics           : 14.3.3
@ngrx/store                : 14.3.3
@ngrx/store-devtools       : 12.5.1
ng-mocks                   : 12.5.1
rxjs                       : 6.5.5

Failure Logs

No response

Package Manager Version

yarn 1.22.21

Operating System

Additional Information

I am trying to migrate an old Nx project, Node 14.17.1 with @rewl/cli@12.2.11 to Node 18.19.1 nx@18.1.0.

I have run and rerun migrates on individual packages and eventually tried a blanket npx nx migrate latest I have repeatedly dumped the node_modules and yarn.lock and run and rerun nx reset

Still I get the Error NX tasksRunner is not a function on any nx command I try to run, from the VsCode console or command line.

I created a fresh project and copied the app over – this does run nx commands, albeit with a myriad Errors due to the bumped version of Angular. Both projects are using nx 18.1.0.

Package.json for the failing project is below:

{
  "name": "personalised-offers-platform",
  "version": "0.0.0",
  "scripts": {
    "nx": "nx",
    "start": "nx serve",
    "build": "nx build",
    "test": "nx test",
    "lint": "nx workspace-lint && nx lint",
    "test_headless": "npx nx test personalised-offers-platform --browsers ChromeHeadlessNoSandbox --watch=false",
    "test_headless:bullseye": "npx nx test bullseye --browsers ChromeHeadlessNoSandbox --watch=false",
    "test_cydashboard": "npx nx e2e personalised-offers-platform-e2e --record --key 4a5df266-5d33-467a-8423-b6981354b3bc",
    "test_cy:local": "npx nx e2e personalised-offers-platform-e2e --env.fileConfig=local --watch=false",
    "test_cy:dev": "npx nx e2e personalised-offers-platform-e2e --env.fileConfig=dev --watch=false --reporter junit --reporter-options 'mochaFile=reports/results-[hash].xml,toConsole=true'",
    "test_cy:stage": "npx nx e2e personalised-offers-platform-e2e --env.fileConfig=stage --watch=false",
    "test_cy:production": "npx nx e2e personalised-offers-platform-e2e --env.fileConfig=production --watch=false",
    "test_cyjunitreports": "npx nx e2e personalised-offers-platform-e2e --env.fileConfig=local --reporter junit --reporter-options 'mochaFile=reports/results-[hash].xml,toConsole=true'",
    "lint:styles": "stylelint **/*.scss",
    "e2e": "nx e2e",
    "affected:apps": "nx affected:apps",
    "affected:libs": "nx affected:libs",
    "affected:build": "nx affected:build",
    "affected:e2e": "nx affected:e2e",
    "affected:test": "nx affected:test",
    "affected:lint": "nx affected:lint",
    "affected:dep-graph": "nx affected:dep-graph",
    "affected": "nx affected",
    "format": "nx format:write",
    "format:write": "nx format:write",
    "format:check": "nx format:check",
    "dep-graph": "nx dep-graph",
    "help": "nx help",
    "workspace-generator": "nx workspace-generator",
    "postinstall": "ngcc --properties es2015 browser module main",
    "playwright:test": "npx playwright test .apps/tests",
    "test_play_e2e": "npx playwright test --grep @e2e",
    "test_play_reg": "npx playwright test --grep @reg"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "14.3.0",
    "@angular/cdk": "14.2.7",
    "@angular/common": "14.3.0",
    "@angular/compiler": "14.3.0",
    "@angular/core": "14.3.0",
    "@angular/forms": "14.3.0",
    "@angular/localize": "14.3.0",
    "@angular/material": "14.2.7",
    "@angular/material-moment-adapter": "14.2.7",
    "@angular/platform-browser": "14.3.0",
    "@angular/platform-browser-dynamic": "14.3.0",
    "@angular/router": "14.3.0",
    "@azure/msal-browser": "^2.0.0",
    "@ng-bootstrap/ng-bootstrap": "^10.0.0",
    "@ngrx/component-store": "14.3.3",
    "@ngrx/effects": "14.3.3",
    "@ngrx/entity": "14.3.3",
    "@ngrx/router-store": "14.3.3",
    "@ngrx/store": "14.3.3",
    "@ngrx/store-devtools": "12.5.1",
    "bootstrap": "^4.4.0",
    "deep-equal": "^1.1.1",
    "file-saver": "^2.0.5",
    "global": "^4.4.0",
    "jquery": "^3.6.0",
    "karma-spec-reporter-2": "^0.2.0",
    "lodash": "^4.17.21",
    "moment": "^2.29.1",
    "ngx-color": "^6.2.0",
    "ngx-contextmenu": "^6.0.0",
    "ngx-material-file-input": "^2.1.1",
    "normalize.css": "^8.0.1",
    "playwright": "^1.18.1",
    "popper.js": "^1.16.1",
    "rxjs": "~6.5.4",
    "stylelint": "^13.5.0",
    "tslib": "2.6.2",
    "xlsx": "0.14.2",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "14.2.13",
    "@angular-eslint/eslint-plugin": "14.4.1-alpha.0",
    "@angular-eslint/eslint-plugin-template": "14.4.1-alpha.0",
    "@angular-eslint/template-parser": "14.4.0",
    "@angular/cli": "^17.2.3",
    "@angular/compiler-cli": "14.3.0",
    "@angular/language-service": "14.3.0",
    "@ngrx/schematics": "14.3.3",
    "@ngrx/store-devtools": "14.3.3",
    "@nx/angular": "18.1.0",
    "@nx/cypress": "18.1.0",
    "@nx/eslint": "18.1.0",
    "@nx/eslint-plugin": "18.1.0",
    "@nx/jest": "18.1.0",
    "@nx/workspace": "18.1.0",
    "@playwright/test": "^1.40.1",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "~2.0.3",
    "@types/jest": "27.0.2",
    "@types/node": "18.16.9",
    "@typescript-eslint/eslint-plugin": "6.21.0",
    "@typescript-eslint/parser": "6.21.0",
    "codelyzer": "^6.0.0",
    "cypress": "^8.3.0",
    "cypress-cucumber-preprocessor": "^4.3.1",
    "cypress-junit-reporter": "^1.3.1",
    "cypress-localstorage-commands": "^2.1.0",
    "eslint": "8.48.0",
    "eslint-config-prettier": "9.1.0",
    "eslint-plugin-cypress": "^2.10.3",
    "eslint-plugin-etc": "^1.5.4",
    "eslint-plugin-import": "^2.26.0",
    "eslint-plugin-rxjs": "^3.3.7",
    "eslint-plugin-sonarjs": "^0.13.0",
    "husky": "^4.2.5",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "jest": "^27.2.3",
    "jest-preset-angular": "10.0.1",
    "karma": "~5.0.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "~3.0.2",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "karma-junit-reporter": "^2.0.1",
    "karma-parallel": "^0.3.1",
    "karma-spec-reporter": "0.0.32",
    "lint-staged": "^10.2.7",
    "ng-mocks": "^12.2.0",
    "nx": "18.1.0",
    "postcss": "^8.3.5",
    "prettier": "^2.4.1",
    "protractor": "~7.0.0",
    "stylelint": "^13.5.0",
    "stylelint-config-sass-guidelines": "^7.0.0",
    "stylelint-config-standard": "^20.0.0",
    "ts-jest": "^27.0.5",
    "ts-node": "~10.9.1",
    "tslint": "~6.1.0",
    "typescript": "~4.3.5"
  },
  "lint-staged": {
    "*.{css,less,sass,scss}": [
      "./node_modules/.bin/stylelint --fix"
    ]
  },
  "cypress-cucumber-preprocessor": {
    "nonGlobalStepDefinitions": true
  },
  "husky": {
    "hooks": {
      "pre-commit": "lint-staged"
    }
  }
}
gclapham commented 6 months ago

I fixed the issue. The migrate command didn't rewrite all configs. I still had some pointing to @nrwl, which I edited manually.

Bulletninja commented 5 months ago

if not to @nrwl, where should it point to? @nx ?

github-actions[bot] commented 4 months 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.