ng lint throws Node error in Angular 14: UnhandledPromiseRejectionWarning: #<Object>

Viewed 123

I upgraded my app from Angular 13 to 14, and now when I try to use ng lint command with latest eslint installed, this error appears:

(node:15376) UnhandledPromiseRejectionWarning: #<Object>
(Use `node --trace-warnings ...` to show where the warning was created)
(node:15376) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:15376) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

I have no idea how to solve this, without downgrading back to 13. This are my devDependencies:

"devDependencies": {
    "@angular-devkit/build-angular": "^14.2.1",
    "@angular-eslint/builder": "14.0.3",
    "@angular-eslint/eslint-plugin": "14.0.3",
    "@angular-eslint/eslint-plugin-template": "14.0.3",
    "@angular-eslint/schematics": "14.0.3",
    "@angular-eslint/template-parser": "14.0.3",
    "@angular/cli": "^14.2.1",
    "@angular/compiler-cli": "^14.2.0",
    "@angular/language-service": "^14.2.0",
    "@ngxs/devtools-plugin": "~3.7.1",
    "@progress/kendo-licensing": "~1.2.2",
    "@types/lodash": "~4.14.168",
    "@typescript-eslint/eslint-plugin": "5.29.0",
    "@typescript-eslint/parser": "5.29.0",
    "@webcomponents/custom-elements": "^1.4.3",
    "eslint": "^8.18.0",
    "eslint-plugin-deprecation": "^1.3.2",
    "typescript": "^4.6.4"
  }
1 Answers

I got this same error. I tried everything I could think of. Eventually I redid my tsconfig.json and .eslint.json. Basically I generated a new angular project and just copied the tsconfig.json and the .eslint.json files and suddenly ng lint worked for me.

Related