由于 ESLint,无法更新 Angular CLI
Couldn't update Angular CLI due to ESLint
我正在使用 Angular 打字稿开发 Web 应用程序。最近,我尝试更新@angular/cli 包,但出现以下错误:
(env) ➜ tsclient git:(feature/my-branch) npm install --save-dev @angular/cli@latest
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-app@13.3.0
npm ERR! Found: @angular/cli@12.0.0
npm ERR! node_modules/@angular/cli
npm ERR! dev @angular/cli@"12.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/cli@">= 11.2.0 < 12.0.0" from @angular-eslint/builder@4.2.0
npm ERR! node_modules/@angular-eslint/builder
npm ERR! dev @angular-eslint/builder@"4.2.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/sabareesh/.npm/eresolve-report.txt for a full report.
这是我的 package.json
:
{
"name": "my-app",
"version": "13.3.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^11.2.9",
"@angular/cdk": "^11.2.8",
"@angular/common": "^11.2.9",
"@angular/compiler": "^11.2.9",
"@angular/core": "^11.2.9",
"@angular/forms": "^11.2.9",
"@angular/material": "^11.2.8",
"@angular/platform-browser": "^11.2.9",
"@angular/platform-browser-dynamic": "^11.2.9",
"@angular/router": "^11.2.9",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1102.8",
"@angular-eslint/builder": "4.2.0",
"@angular-eslint/eslint-plugin": "4.2.0",
"@angular-eslint/eslint-plugin-template": "4.2.0",
"@angular-eslint/schematics": "4.2.0",
"@angular-eslint/template-parser": "4.2.0",
"@angular/cli": "^11.2.10",
"@angular/compiler-cli": "^11.2.9",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "4.16.1",
"@typescript-eslint/parser": "4.16.1",
"eslint": "^7.6.0",
"eslint-plugin-import": "latest",
"eslint-plugin-jsdoc": "latest",
"eslint-plugin-prefer-arrow": "latest",
"jasmine-core": "~3.7.1",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.6.0",
"ng-packagr": "^11.2.4",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"typescript": "^4.1.5"
},
"eslintIgnore": [
"*.spec.ts",
"app.po.ts",
"environment.ts",
"polyfills.ts",
"test.ts"
]
}
我认为错误是由于@angular-eslint/builder 依赖于较低的 angular CLI 版本。所以,我尝试更新@angular-eslint/builder,但也没有更新。
@angular-eslint/builder@4.3.0 package.json
和
@angular-eslint/builder@最新package.json
看到差异了吗?
尝试将所有 angular 软件包与其他软件包一起升级到 v12
或者使用标志 --force 忽略上面的错误
我正在使用 Angular 打字稿开发 Web 应用程序。最近,我尝试更新@angular/cli 包,但出现以下错误:
(env) ➜ tsclient git:(feature/my-branch) npm install --save-dev @angular/cli@latest
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-app@13.3.0
npm ERR! Found: @angular/cli@12.0.0
npm ERR! node_modules/@angular/cli
npm ERR! dev @angular/cli@"12.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/cli@">= 11.2.0 < 12.0.0" from @angular-eslint/builder@4.2.0
npm ERR! node_modules/@angular-eslint/builder
npm ERR! dev @angular-eslint/builder@"4.2.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/sabareesh/.npm/eresolve-report.txt for a full report.
这是我的 package.json
:
{
"name": "my-app",
"version": "13.3.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^11.2.9",
"@angular/cdk": "^11.2.8",
"@angular/common": "^11.2.9",
"@angular/compiler": "^11.2.9",
"@angular/core": "^11.2.9",
"@angular/forms": "^11.2.9",
"@angular/material": "^11.2.8",
"@angular/platform-browser": "^11.2.9",
"@angular/platform-browser-dynamic": "^11.2.9",
"@angular/router": "^11.2.9",
"rxjs": "~6.6.0",
"tslib": "^2.0.0",
"zone.js": "~0.11.3"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.1102.8",
"@angular-eslint/builder": "4.2.0",
"@angular-eslint/eslint-plugin": "4.2.0",
"@angular-eslint/eslint-plugin-template": "4.2.0",
"@angular-eslint/schematics": "4.2.0",
"@angular-eslint/template-parser": "4.2.0",
"@angular/cli": "^11.2.10",
"@angular/compiler-cli": "^11.2.9",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"@typescript-eslint/eslint-plugin": "4.16.1",
"@typescript-eslint/parser": "4.16.1",
"eslint": "^7.6.0",
"eslint-plugin-import": "latest",
"eslint-plugin-jsdoc": "latest",
"eslint-plugin-prefer-arrow": "latest",
"jasmine-core": "~3.7.1",
"jasmine-spec-reporter": "~5.0.0",
"karma": "~6.1.0",
"karma-chrome-launcher": "~3.1.0",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.6.0",
"ng-packagr": "^11.2.4",
"protractor": "~7.0.0",
"ts-node": "~8.3.0",
"typescript": "^4.1.5"
},
"eslintIgnore": [
"*.spec.ts",
"app.po.ts",
"environment.ts",
"polyfills.ts",
"test.ts"
]
}
我认为错误是由于@angular-eslint/builder 依赖于较低的 angular CLI 版本。所以,我尝试更新@angular-eslint/builder,但也没有更新。
@angular-eslint/builder@4.3.0 package.json
和
@angular-eslint/builder@最新package.json
看到差异了吗? 尝试将所有 angular 软件包与其他软件包一起升级到 v12 或者使用标志 --force 忽略上面的错误