简体   繁体   English

Angular TSLint - 找不到构建器“@angular-devkit/build-angular:tslint”

[英]Angular TSLint - Cannot find builder "@angular-devkit/build-angular:tslint"

When I try to run command ng lint --fix cli throws this error:当我尝试运行命令ng lint --fix cli 时抛出此错误:

An unhandled exception occurred: Cannot find builder "@angular-devkit/build-angular:tslint".
See "C:\Users\MOE89A~1.ZAR\AppData\Local\Temp\ng-Ijc3an\angular-errors.log" for further details.

My lint confing in angular.json :我在angular.json中配置的棉绒:

"lint": {
  "builder": "@angular-devkit/build-angular:tslint",
  "options": {
    "tsConfig": [
      "projects/wepod-app/tsconfig.app.json",
      "projects/wepod-app/tsconfig.spec.json",
      "projects/wepod-app/e2e/tsconfig.json"
    ],
    "exclude": [
      "**/node_modules/**"
    ]
  }
},

My package.json :我的package.json

{
  "name": "wepod-clients",
  "version": "3.2.3",
  "scripts": {
    "ng": "ng",
    "start": "node patch.js && ng serve",
    "build": "node patch.js && node --max_old_space_size=8192 ./node_modules/@angular/cli/bin/ng run wepod-app:app-shell:production && ng run wepod-app:auth-standalone:production",
    "server": "npm run build && http-server -p 9090 -c-1 dist",
    "test": "ng test",
    "lint": "ng lint --fix",
    "e2e": "ng e2e",
    "postinstall": "node patch.js && ngcc",
    "postbuild": "node post-build.js",
    "prepare": "husky install",
    "build-latest": "git pull origin production && npm run build"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^13.0.0",
    "@angular/cdk": "^13.0.0",
    "@angular/cli": "^13.0.1",
    "@angular/common": "^13.0.0",
    "@angular/compiler": "^13.0.0",
    "@angular/core": "^13.0.0",
    "@angular/forms": "^13.0.0",
    "@angular/localize": "^13.0.0",
    "@angular/platform-browser": "^13.0.0",
    "@angular/platform-browser-dynamic": "^13.0.0",
    "@angular/platform-server": "^13.0.0",
    "@angular/router": "^13.0.0",
    "@angular/service-worker": "^13.0.0",
    "@types/video.js": "^7.3.27",
    "animate.css": "^4.1.1",
    "assert": "^2.0.0",
    "bowser": "^2.11.0",
    "buffer": "^6.0.3",
    "bundle-loader": "^0.5.6",
    "compare-version": "^0.1.2",
    "constants-browserify": "^1.0.0",
    "crypto-browserify": "^3.12.0",
    "crypto-js": "^4.1.1",
    "d3": "^6.5.0",
    "hammerjs": "^2.0.8",
    "https-browserify": "^1.0.0",
    "jalali-moment": "^3.3.10",
    "lottie-web": "^5.7.13",
    "lzutf8": "^0.6.0",
    "net": "^1.0.2",
    "ng-gallery": "^5.1.1",
    "ng2-jalali-date-picker": "^2.4.2",
    "ngx-device-detector": "^1.5.2",
    "ngx-doughnut-chart": "0.0.4",
    "ngx-infinite-scroll": "^8.0.2",
    "ngx-lottie": "^7.0.4",
    "ngx-owl-carousel-o": "^3.1.1",
    "ngx-skeleton-loader": "^2.10.1",
    "ngx-toastr": "^12.1.0",
    "os-browserify": "^0.3.0",
    "podchat-browser": "^10.14.13",
    "rxjs": "^6.6.7",
    "stream-browserify": "^3.0.0",
    "stream-http": "^3.2.0",
    "tls": "0.0.1",
    "tslib": "^2.0.0",
    "uuid": "^8.3.2",
    "video.js": "^7.15.4",
    "videojs-record": "^4.5.0",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^13.0.1",
    "@angular-devkit/core": "^13.0.1",
    "@angular/compiler-cli": "^13.0.0",
    "@angular/language-service": "^13.0.0",
    "@egjs/hammerjs": "^2.0.17",
    "@types/hammerjs": "^2.0.40",
    "@types/jasmine": "~3.6.0",
    "@types/jasminewd2": "^2.0.10",
    "@types/node": "^12.20.36",
    "codelyzer": "^6.0.0",
    "colors": "^1.4.0",
    "git-tag-version": "^1.3.1",
    "gulp": "^4.0.2",
    "gulp-gzip": "^1.4.2",
    "http-server": "^14.0.0",
    "husky": "^7.0.4",
    "jasmine-core": "~3.6.0",
    "jasmine-spec-reporter": "~5.0.0",
    "karma": "^6.3.7",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage-istanbul-reporter": "^2.1.0",
    "karma-jasmine": "~4.0.0",
    "karma-jasmine-html-reporter": "^1.5.0",
    "protractor": "^7.0.0",
    "ts-node": "^8.10.2",
    "tslint": "^6.1.3",
    "typescript": "4.4.4",
    "zip-dir": "^2.0.0"
  },
  "browser": {
    "fs": false,
    "path": false,
    "os": false
  }
}

From v13 angular doesn't use tslint anymore due to deprecation .从 v13 angular 开始,由于deprecation不再使用tslint

Run ng add @angular-eslint/schematics to add eslint to your application.运行ng add @angular-eslint/schematics以将eslint添加到您的应用程序中。

It will use tslint-to-eslint-config to migrate you to eslint automatically.它将使用tslint-to-eslint-config自动将您迁移到eslint

It will generate a .eslintrc.json file and migrate tslint.json to it.它将生成一个.eslintrc.json文件并将tslint.json迁移到它。

Nothing else is needed to be done.不需要做任何其他事情。

@MahdiJoon is a great answer. @MahdiJoon 是一个很好的答案。 I think that it will work for most projects.我认为它适用于大多数项目。

I'm adding this answer for developers who have already deleted tslint manually, like I did.我正在为已经手动删除tslint的开发人员添加这个答案,就像我一样。

If you did that, like me, then:如果你像我一样那样做,那么:

  1. ng add @angular-eslint/schematics to install eslint ng add @angular-eslint/schematics来安装eslint
  2. ng g @angular-eslint/schematics:convert-tslint-to-eslint <project-name> to migrate tslint.json config to .eslintrc.json ng g @angular-eslint/schematics:convert-tslint-to-eslint <project-name>tslint.json配置迁移到.eslintrc.json
  3. (optional) run the previous command for any other project (eg e2e ) (可选)为任何其他项目运行上一个命令(例如e2e

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 发生未处理的异常:找不到模块“@angular-devkit/build-angular” - An unhandled exception occurred: Could not find module "@angular-devkit/build-angular" 无法从“F:\\\\Angular Projects\\\\cmp-databinding-start”中找到模块“@angular-devkit/build-angular” - Could not find module "@angular-devkit/build-angular" from "F:\\Angular Projects\\cmp-databinding-start" 找不到模块“@angular-devkit/core” - Cannot find module '@angular-devkit/core' 当我更新“@angular-devkit/build-angular”时,style-loader 停止工作 - style-loader stop working when I update "@angular-devkit/build-angular" 离子服务后找不到模块(webpack)/hot/emitter @angular-devkit/build-angular - Ionic 4 - Module not found (webpack)/hot/emitter @angular-devkit/build-angular after ionic serve - Ionic 4 错误:模块构建失败(来自./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js): - Error: Module build failed (from ./node_modules/@angular-devkit/build-angular/src/babel/webpack-loader.js): 找不到模块“@angular-devkit/schematics/tasks” - Cannot find module '@angular-devkit/schematics/tasks' ./src/main.ts - 错误:模块构建失败(来自./node_modules/@angular-devkit/build-angular/node_modules/@ngtools/webpack/src/ivy/index.js): - ./src/main.ts - Error: Module build failed (from ./node_modules/@angular-devkit/build-angular/node_modules/@ngtools/webpack/src/ivy/index.js): npm WARN @angular-devkit/build-angular@14.0.6 需要对等 xxxx 但没有安装 - npm WARN @angular-devkit/build-angular@14.0.6 requires a peer xxxx but none is installed 更新 angular-devkit 并失败:Microsoft.AspNetCore.SpaServices[0] - Update angular-devkit and got fail: Microsoft.AspNetCore.SpaServices[0]
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM