I recently added linting to my Angular project, which worked fine initially, but has recently stopped working. When I run ng lint I get the following error message:
An unhandled exception occurred: Cannot find module '@typescript-eslint/utils' Require stack:
C:\Projects\TestProj\Web\node_modules@angular-eslint\utils\dist\eslint-plugin\ast-utils.js
C:\Projects\TestProj\Web\node_modules@angular-eslint\utils\dist\index.js
C:\Projects\TestProj\Web\node_modules@angular-eslint\eslint-plugin\dist\rules\component-class-suffix.js
C:\Projects\TestProj\Web\node_modules@angular-eslint\eslint-plugin\dist\index.js
C:\Projects\TestProj\Web\node_modules\angular-eslint\dist\index.js
C:\Projects\TestProj\Web\eslint.config.js
I have tried:
npm i @angular-eslint/utils
npm install
npm clean-install
ng build
I'm pretty new to Angular so please let me know if I've missed anything obvious. Here's my package.json file:
"name": "testProj",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test",
"serve:ssr:testProj": "node dist/testProj/server/server.mjs",
"build-prod": "ng build",
"lint": "ng lint"
},
"private": true,
"dependencies": {
"@angular-eslint/utils": "^18.3.1",
"@angular/animations": "^18.1.0",
"@angular/common": "^18.1.0",
"@angular/compiler": "^18.1.0",
"@angular/core": "^18.1.0",
"@angular/forms": "^18.1.0",
"@angular/platform-browser": "^18.1.0",
"@angular/platform-browser-dynamic": "^18.1.0",
"@angular/platform-server": "^18.1.0",
"@angular/router": "^18.1.0",
"@angular/ssr": "^18.1.0",
"@ng-bootstrap/ng-bootstrap": "^17.0.1",
"@popperjs/core": "^2.11.8",
"bootstrap": "^5.3.3",
"express": "^4.18.2",
"rxjs": "~7.8.0",
"tslib": "^2.3.0",
"zone.js": "~0.14.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "^18.1.0",
"@angular/cli": "^18.1.0",
"@angular/compiler-cli": "^18.1.0",
"@angular/localize": "^18.1.0",
"@types/express": "^4.17.17",
"@types/jasmine": "~5.1.0",
"@types/node": "^18.18.0",
"angular-eslint": "18.3.1",
"eslint": "^9.9.1",
"jasmine-core": "~5.1.0",
"karma": "~6.4.0",
"karma-chrome-launcher": "~3.2.0",
"karma-coverage": "~2.2.0",
"karma-jasmine": "~5.1.0",
"karma-jasmine-html-reporter": "~2.1.0",
"typescript": "~5.5.3",
"typescript-eslint": "8.2.0"
}
}
Let me know if you'd like any more info. Thanks.
I found the issue. Running npm i @typescript-eslint/utils
fixed it. I had mistakenly previously tried installing the package named @angular-eslint/utils
.
This was a pretty silly mistake but I'm going to leave the post up anyway since there aren't any other search results for this error message.