I'm having a weird problem where suddenly GitHub Action workflow is failing compiling an Angular project, while it still works on my (and my peers) local machine. Note I'm running npm ci
and not npm install
.
This is the error I'm getting:
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @angular-eslint/[email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/cli
npm ERR! dev @angular/cli@"^14.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/cli@">= 13.0.0 < 14.0.0" from @angular-eslint/[email protected]
npm ERR! node_modules/@angular-eslint/schematics
npm ERR! dev @angular-eslint/schematics@"^13.2.1" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/cli
npm ERR! peer @angular/cli@">= 13.0.0 < 14.0.0" from @angular-eslint/[email protected]
npm ERR! node_modules/@angular-eslint/schematics
npm ERR! dev @angular-eslint/schematics@"^13.2.1" 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/runner/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-06-09T16_17_41_426Z-debug-0.log
Error: Process completed with exit code 1.
And this is my package.json
:
{
"name": "dashboard",
"version": "0.0.0",
"scripts": {
"build": "ng build --source-map=false",
"start": "ng serve --configuration walabot-home",
"dev": " ng serve --configuration walabothome-app-cloud"
},
"engines": {
"node": "16"
},
"private": true,
"dependencies": {
"@angular/animations": "^14.0.0",
"@angular/cdk": "^14.0.1",
"@angular/common": "^14.0.0",
"@angular/compiler": "^14.0.0",
"@angular/core": "^14.0.0",
"@angular/forms": "^14.0.0",
"@angular/localize": "^14.0.0",
"@angular/material": "^14.0.1",
"@angular/platform-browser": "^14.0.0",
"@angular/platform-browser-dynamic": "^14.0.0",
"@angular/router": "^14.0.0",
"@types/hammerjs": "^2.0.41",
"angular2-csv": "^0.2.9",
"axios": "^0.27.2",
"core-js": "^3.22.8",
"firebase": "^9.8.2",
"ngx-material-timepicker": "^5.5.3",
"rxjs": "^7.5.5",
"tslib": "^2.4.0",
"zone.js": "^0.11.5"
},
"devDependencies": {
"@angular-devkit/build-angular": "^14.0.0",
"@angular/cli": "^14.0.0",
"@angular/compiler-cli": "^14.0.0",
"@angular/language-service": "^14.0.0",
"@types/jasmine": "^4.0.3",
"@types/jasminewd2": "^2.0.10",
"codelyzer": "^6.0.2",
"esbuild": "^0.14.43",
"jasmine-core": "^4.1.1",
"jasmine-spec-reporter": "^7.0.0",
"karma": "^6.3.20",
"karma-chrome-launcher": "^3.1.1",
"karma-coverage-istanbul-reporter": "^3.0.3",
"karma-jasmine": "^5.0.1",
"karma-jasmine-html-reporter": "^2.0.0",
"luxon": "^2.4.0",
"openapi-typescript-codegen": "^0.23.0",
"protractor": "^7.0.0",
"ts-node": "^10.8.1",
"tslint": "^6.1.0",
"typescript": "^4.7.3"
},
"optionalDependencies": {
"fsevents": "2.3.2"
}
}
The CI workflow:
name: Dashboard
on:
workflow_call:
inputs:
project-id:
required: true
type: string
jobs:
build:
runs-on: [ubuntu-latest]
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "npm"
cache-dependency-path: package-lock.json
- run: npm ci
- run: npm run build -- --configuration=${{ inputs.project-id }}
- uses: actions/upload-artifact@v3
with:
name: dashboard-dist
path: dashboard/dist
Edit: things are still broken when downgrading to Angular CLI 13:
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR! @angular/common@"^14.0.0" from the root project
npm ERR! peer @angular/common@"^14.0.0 || ^15.0.0" from @angular/[email protected]
npm ERR! node_modules/@angular/cdk
npm ERR! @angular/cdk@"^14.0.1" from the root project
npm ERR! peer @angular/cdk@"14.0.1" from @angular/[email protected]
npm ERR! node_modules/@angular/material
npm ERR! @angular/material@"^14.0.1" from the root project
npm ERR! 5 more (@angular/forms, @angular/material, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/common@"^6.0.0-rc.0 || ^6.0.0" from [email protected]
npm ERR! node_modules/angular2-csv
npm ERR! angular2-csv@"^0.2.9" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: @angular/[email protected]
npm ERR! node_modules/@angular/common
npm ERR! peer @angular/common@"^6.0.0-rc.0 || ^6.0.0" from [email protected]
npm ERR! node_modules/angular2-csv
npm ERR! angular2-csv@"^0.2.9" 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/runner/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2022-06-09T17_31_14_082Z-debug-0.log
CodePudding user response:
Some of your dependencies do not like your recent CLI upgrade to Angular 14. Try to downgrade your CLI version or use --force
flag when you ng update
.
As stated in the Angular Doc
[--force] Ignore peer dependency version mismatches. Passes the '--force' flag to the package manager when installing packages.
CodePudding user response:
As walid said, just downgrade the Angular cli:
devDependencies": {
"@angular/cli": "13.0.0",
Maybe 13 will work for you.