I have an Angular 12 application that is building just fine, with no errors or warning. I use Github to compile and upload it to Azure.
Here is my package.json
{
"name": "My Application",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"watch": "ng build --watch --configuration development",
"test": "ng test"
},
"private": true,
"dependencies": {
"@angular-slider/ngx-slider": "^2.0.3",
"@angular/animations": "~12.1.1",
"@angular/cdk": "^12.1.1",
"@angular/common": "~12.1.1",
"@angular/compiler": "~12.1.1",
"@angular/core": "~12.1.1",
"@angular/forms": "~12.1.1",
"@angular/material": "^12.1.1",
"@angular/platform-browser": "~12.1.1",
"@angular/platform-browser-dynamic": "~12.1.1",
"@angular/router": "~12.1.1",
"@kolkov/angular-editor": "^1.2.0",
"@ng-bootstrap/ng-bootstrap": "^10.0.0",
"@ng-select/ng-select": "^7.2.0",
"@sweetalert2/ngx-sweetalert2": "^10.0.0",
"@swimlane/ngx-datatable": "^19.0.0",
"@types/chartist": "^0.11.1",
"@types/leaflet": "^1.5.19",
"animate.css": "^4.1.1",
"bootstrap": "^5.0.2",
"chart.js": "^2.9.4",
"chartist": "^0.11.4",
"check-password-strength": "^2.0.7",
"crypto-js": "^4.1.1",
"file-saver": "^2.0.5",
"material-icons": "^1.0.1",
"moment": "^2.29.1",
"ng-recaptcha": "^9.0.0",
"ng2-charts": "^2.4.2",
"ngx-bootstrap": "^7.0.0",
"ngx-color-picker": "^11.0.0",
"ngx-daterangepicker-material": "^5.0.1",
"ngx-mask": "^12.0.0",
"ngx-perfect-scrollbar": "^10.1.1",
"npm-check-updates": "^16.4.1",
"perfect-scrollbar": "^1.5.3",
"primeicons": "^5.0.0",
"primeng": "^13.0.4",
"rxjs": "^6.0.0",
"sweetalert2": "^11.1.7",
"tslib": "^2.2.0",
"typicons.font": "^2.1.2",
"web-animations-js": "^2.3.2",
"zone.js": "^0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.1.1",
"@angular/cli": "~12.1.1",
"@angular/compiler-cli": "~12.1.1",
"@types/ckeditor__ckeditor5-build-classic": "^28.0.0",
"@types/hammerjs": "^2.0.40",
"@types/node": "^12.11.1",
"typescript": "~4.3.2"
}
}
As said, I can ng build just fine, but here is what I get at Git
Running 'npm install --unsafe-perm'...
57
58
npm ERR! code ERESOLVE
59
npm ERR! ERESOLVE could not resolve
60
npm ERR!
61
npm ERR! While resolving: @ng-bootstrap/[email protected]
62
npm ERR! Found: @angular/[email protected]
63
npm ERR! node_modules/@angular/compiler
64
npm ERR! @angular/compiler@"~12.1.1" from the root project
65
npm ERR! peer @angular/compiler@"12.1.5" from @angular/[email protected]
66
npm ERR! node_modules/@angular/compiler-cli
67
npm ERR! dev @angular/compiler-cli@"~12.1.1" from the root project
68
npm ERR! peer @angular/compiler-cli@"^12.0.0 || ^12.1.0-next" from @angular-devkit/[email protected]
69
npm ERR! node_modules/@angular-devkit/build-angular
70
npm ERR! dev @angular-devkit/build-angular@"~12.1.1" from the root project
71
npm ERR! 1 more (@ngtools/webpack)
72
npm ERR! 1 more (@angular/platform-browser-dynamic)
73
npm ERR!
74
npm ERR! Could not resolve dependency:
75
npm ERR! peer @angular/localize@"^12.0.0" from @ng-bootstrap/[email protected]
76
npm ERR! node_modules/@ng-bootstrap/ng-bootstrap
77
npm ERR! @ng-bootstrap/ng-bootstrap@"^10.0.0" from the root project
78
npm ERR!
79
npm ERR! Conflicting peer dependency: @angular/[email protected]
80
npm ERR! node_modules/@angular/compiler
81
npm ERR! peer @angular/compiler@"12.2.16" from @angular/[email protected]
82
npm ERR! node_modules/@angular/localize
83
npm ERR! peer @angular/localize@"^12.0.0" from @ng-bootstrap/[email protected]
84
npm ERR! node_modules/@ng-bootstrap/ng-bootstrap
85
npm ERR! @ng-bootstrap/ng-bootstrap@"^10.0.0" from the root project
86
npm ERR!
87
npm ERR! Fix the upstream dependency conflict, or retry
88
npm ERR! this command with --force, or --legacy-peer-deps
89
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
90
npm ERR!
91
Im runninng Node 16.14.1.
All this happened suddenly.
I've tried updating npm several times. I uninstalled and installed all npm's, I deleted package-lock and node_modules and reinstalled everything. Nothing worked.
Thanks for your help.
CodePudding user response:
you have a dependency conflict try this
npm install --legacy-peer-deps
check this it could help you