角度 14"ng lint"命令不起作用如何运行命令



每当我点击这个命令"ng font "我得到以下错误:Cannot find "lint" target fo the specified project. You can add a package that implements these capabilities..

截图添加@angular-eslint/schematics后,我再次尝试ng lint命令,但结果保持不变。

Package.json

{
"name": "xyz",
"version": "0.0.0",
"scripts": {
"build": "ng build",
"build:app": "ng build xyz --configuration production",
"doc:app": "./node_modules/.bin/compodoc -p src/tsconfig.app.json -t --hideGenerator -d "dist/docs/app"",
"e2e": "ng e2e pjms-admin-e2e --webdriver-update=false",
"e2e:ci": "ng e2e xyz-e2e --webdriver-update=false --protractor-config=./e2e/protractor-ci.conf.js",
"lint": "ng lint",
"lint:app": "ng lint xyz",
"ng": "ng",
"postbuild:app": "npm run doc:app",
"pree2e": "webdriver-manager update --ignore_ssl=true --gecko false",
"start": "ng serve",
"start:hmr": "ng serve --port 4201 --hmr -c=hmr",
"start:subpath": "ng serve --port 4202 --serve-path=/test/ --base-href=/test/",
"test": "ng test"
},
"private": true,
"dependencies": {
"angular/animations": "^14.2.8",
"@angular/cdk": "^14.2.6",
"@angular/common": "^14.2.8",
"@angular/compiler": "^14.2.8",
"@angular/core": "^14.2.8",
"@angular/flex-layout": "^14.0.0-beta.40",
"@angular/forms": "^14.2.8",
"@angular/material": "^14.2.6",
"@angular/platform-browser": "^14.2.8",
"@angular/platform-browser-dynamic": "^14.2.8",
"@angular/router": "^14.2.8",
"@ngx-translate/core": "^11.0.1",
"@ngx-translate/http-loader": "^4.0.0",
"core-js": "^2.6.5",
"mat-table-exporter": "^10.2.4",
"ngx-filesize": "^2.0.16",
"node-sass": "^4.14.1",
"rxjs": "~6.6.7",
"tslib": "^2.0.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.2.7",
"@angular/cli": "^14.2.7",
"@angular/compiler-cli": "^14.2.8",
"@angular/language-service": "^14.2.8",
"@angularclass/hmr": "^2.1.3",
"@compodoc/compodoc": "^1.1.3",
"@types/googlemaps": "^3.39.12",
"@types/jasmine": "~3.6.0",
"@types/jasminewd2": "~2.0.3",
"@types/node": "^12.11.1",
"codelyzer": "^6.0.0",
"cpx": "^1.5.0",
"jasmine-core": "~3.6.0",
"jasmine-reporters": "^2.3.1",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.4.1",
"karma-chrome-launcher": "~3.1.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "~3.0.2",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"karma-junit-reporter": "^1.2.0",
"protractor": "~7.0.0",
"protractor-console-plugin": "^0.1.1",
"puppeteer": "^1.5.0",
"ts-node": "~7.0.0",
"tslint": "~6.1.0",
"typescript": "~4.6.4"
}
}

我想使用"ng "我的应用程序不工作

这是我的角。json文件

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

您的angular.json文件缺少lint目标。

根据提供的package.json判断,您也没有添加和执行ng add @angular-eslint/schematics原理图。