gpt4 book ai didi

Angular 6.0.1 CLI 在 "Architect"执行时抛出 "ng lint --type-check"错误

转载 作者:太空狗 更新时间:2023-10-29 17:35:25 26 4
gpt4 key购买 nike

在 Angular 和 Angular CLI 更新到 v6 后,每次我尝试运行 ng lint --type-check 时,我的 lint 配置都会抛出以下错误:

Architect commands with multiple targets cannot specify overrides. 'lint' would be run on the following projects: atlas-fe,atlas-fe-e2e

Error: Architect commands with multiple targets cannot specify overrides. 'lint' would be run on the following projects: atlas-fe,atlas-fe-e2e
    at LintCommand.validate (/home/nroma/workspace/atlas/proto-fe/node_modules/@angular/cli/models/architect-command.js:75:23)
    at /home/nroma/workspace/atlas/proto-fe/node_modules/@angular/cli/models/command-runner.js:274:39
    at Generator.next ()
    at /home/nroma/workspace/atlas/proto-fe/node_modules/@angular/cli/models/command-runner.js:7:71
    at new Promise ()
    at __awaiter (/home/nroma/workspace/atlas/proto-fe/node_modules/@angular/cli/models/command-runner.js:3:12)
    at validateAndRunCommand (/home/nroma/workspace/atlas/proto-fe/node_modules/@angular/cli/models/command-runner.js:273:12)
    at Object. (/home/nroma/workspace/atlas/proto-fe/node_modules/@angular/cli/models/command-runner.js:100:26)
    at Generator.next ()
    at fulfilled (/home/nroma/workspace/atlas/proto-fe/node_modules/@angular/cli/models/command-runner.js:4:58)

我正在使用 node v9.9.0 (npm v6.0.1)

这是我的package.json:

{
"name": "atlas-fe",
"version": "0.0.0",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "npm run lint-ts && npm run lint-css",
"lint-ts": "npm run format-ts && ng lint --type-check",
"lint-css": "npm run format-css && stylelint \"src/**/*.{scss,css}\"",
"format": "npm run format-ts && npm run format-css",
"format-ts": "clang-format -i --glob=\"{src,e2e}/**/*.{js,ts}\"",
"format-css": "stylefmt -c .stylelintrc -r \"src/**/*.{scss,css}\"",
"e2e": "ng e2e",
"precommit": "npm run lint"
},
"private": true,
"dependencies": {
"@angular/animations": "^6.0.1",
"@angular/cdk": "^6.0.1",
"@angular/common": "^6.0.1",
"@angular/compiler": "^6.0.1",
"@angular/core": "^6.0.1",
"@angular/flex-layout": "6.0.0-beta.15",
"@angular/forms": "^6.0.1",
"@angular/http": "^6.0.1",
"@angular/material": "^6.0.1",
"@angular/platform-browser": "^6.0.1",
"@angular/platform-browser-dynamic": "^6.0.1",
"@angular/router": "^6.0.1",
"core-js": "^2.4.1",
"fuse.js": "^3.2.0",
"rxjs": "^6.1.0",
"zone.js": "^0.8.14"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.6.1",
"@angular/cli": "^6.0.1",
"@angular/compiler-cli": "^6.0.1",
"@angular/language-service": "^6.0.1",
"@types/jasmine": "~2.5.53",
"@types/jasminewd2": "~2.0.2",
"@types/node": "~6.0.60",
"clang-format": "^1.2.2",
"codelyzer": "^4.1.0",
"husky": "^0.14.3",
"jasmine-core": "~2.6.2",
"jasmine-spec-reporter": "~4.1.0",
"karma": "~1.7.0",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"node-sass": "^4.5.3",
"protractor": "~5.1.2",
"stylefmt": "^6.0.0",
"stylelint-config-recommended": "^1.0.0",
"ts-node": "~3.2.0",
"tslint": "~5.7.0",
"typescript": "~2.7.2"
}
}

最佳答案

CLI 现在似乎为您定义了两个应用程序:your-site 和 your-site-e2e。运行 ng lint 通过在后台某处的命令后添加两个项目名称来隐式运行这两个项目。

但是,如果您将 --type-check 标志添加到您的命令中,隐式结果将变为 ng lint --type-check your-site your-site-e2e 这是无效的参数顺序。

要修复它,请更改以下行:

"lint-ts": "npm run format-ts && ng lint --type-check",

显式变体:

"lint-ts": "npm run format-ts && ng lint atlas-fe atlas-fe-e2e --type-check",

在 angular-cli github 上有一个 Unresolved 问题但到目前为止事件不多。

关于Angular 6.0.1 CLI 在 "Architect"执行时抛出 "ng lint --type-check"错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50414642/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com