У меня есть приложение Angular 12, которое работает нормально, без ошибок или предупреждений. Я использую Github для компиляции и загрузки в Azure.
Вот мой 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"
}
}
Как уже было сказано, я отлично умею собирать ng, но вот что я получаю в 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
Я запускаю узел 16.14.1.
Все это произошло внезапно.
Я пытался обновить npm несколько раз. Я удалил и установил все npm, удалил package-lock и node_modules и все переустановил. Ничего не сработало.
Спасибо за вашу помощь.
Привет Питерян. Да, это так. Я также удалил и восстановил блокировку пакета и получил тот же результат.
у вас конфликт зависимостей попробуй это
npm install --legacy-peer-deps
проверьте это, это может вам помочь
Привет Али. Я пробовал это вчера, и это тоже не сработало.
Эй, Даниэль. проверьте это и дайте мне обратную связь. angularjswiki.com/angular/…
Это сработало! Спасибо Али. Хорошей субботы.
Гораздо лучшим решением было бы исправить конфликт. Новое поведение одноранговых зависимостей существует не просто так.
Ваш package-lock.json находится на github?