#angular #package #dependencies
Вопрос:
Обновление: При попытке обновления с помощью npm install --save @angular/material
я получил эту ошибку:
npm ERR! Found: @angular/animations@8.2.12
npm ERR! node_modules/@angular/animations
npm ERR! @angular/animations@"8.2.12" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/animations@"^12.0.0 || ^13.0.0-0" from @angular/material@12.2.9
npm ERR! node_modules/@angular/material
npm ERR! @angular/material@"*" from the root project
Не уверен, что это поможет. Все еще не уверен, как это понять.
(Я знаю, что по этому поводу есть масса вопросов, но я, похоже, не могу найти объяснение, которое помогло бы мне понять, на что именно я смотрю и как это исправить.)
Поэтому я пытаюсь установить @angular/material ( ng add @angular/material
) в существующий проект angular в Visual Studio 2019.
Вот отчет об ошибке. Я не уверен, какие части имеют отношение к делу, поэтому я включаю все это:
# npm resolution error report
2021-10-13T20:18:49.320Z
While resolving: <myproject>@0.0.0
Found: @angular/compiler@8.2.12
node_modules/@angular/compiler
@angular/compiler@"8.2.12" from the root project
Could not resolve dependency:
peer @angular/compiler@"8.2.14" from @angular/compiler-cli@8.2.14
node_modules/@angular/compiler-cli
dev @angular/compiler-cli@"^8.2.14" from the root project
peer @angular/compiler-cli@"^8.0.0" from @angular-devkit/build-angular@0.803.29
node_modules/@angular-devkit/build-angular
dev @angular-devkit/build-angular@"^0.803.29" from the root project
Fix the upstream dependency conflict, or retry
this command with --force, or --legacy-peer-deps
to accept an incorrect (and potentially broken) dependency resolution.
Raw JSON explanation object:
{
"code": "ERESOLVE",
"current": {
"name": "@angular/compiler",
"version": "8.2.12",
"whileInstalling": {
"name": "<myproject>",
"version": "0.0.0",
"path": "C:\Users\<ME>\Documents\Repositories\<MYPROJECT>\ClientApp"
},
"location": "node_modules/@angular/compiler",
"isWorkspace": false,
"dependents": [
{
"type": "prod",
"name": "@angular/compiler",
"spec": "8.2.12",
"from": {
"location": "C:\Users\<ME>\Documents\Repositories\<MYPROJECT>\ClientApp"
}
}
]
},
"currentEdge": {
"type": "prod",
"name": "@angular/compiler",
"spec": "8.2.12",
"from": {
"location": "C:\Users\<ME>\Documents\Repositories\<MYPROJECT>\ClientApp"
}
},
"edge": {
"type": "peer",
"name": "@angular/compiler",
"spec": "8.2.14",
"error": "INVALID",
"from": {
"name": "@angular/compiler-cli",
"version": "8.2.14",
"whileInstalling": {
"name": "<myproject>",
"version": "0.0.0",
"path": "C:\Users\<ME>\Documents\Repositories\<MYPROJECT>\ClientApp"
},
"location": "node_modules/@angular/compiler-cli",
"isWorkspace": false,
"dependents": [
{
"type": "dev",
"name": "@angular/compiler-cli",
"spec": "^8.2.14",
"from": {
"location": "C:\Users\<ME>\Documents\Repositories\<MYPROJECT>\ClientApp"
}
},
{
"type": "peer",
"name": "@angular/compiler-cli",
"spec": "^8.0.0",
"from": {
"name": "@angular-devkit/build-angular",
"version": "0.803.29",
"whileInstalling": {
"name": "<myproject>",
"version": "0.0.0",
"path": "C:\Users\<ME>\Documents\Repositories\<MYPROJECT>\ClientApp"
},
"location": "node_modules/@angular-devkit/build-angular",
"isWorkspace": false,
"dependents": [
{
"type": "dev",
"name": "@angular-devkit/build-angular",
"spec": "^0.803.29",
"from": {
"location": "C:\Users\<ME>\Documents\Repositories\<MYPROJECT>\ClientApp"
}
}
]
}
}
]
}
},
"strictPeerDeps": false,
"force": false
}
И это мое package.json
:
{
"name": "<myproject>",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build:ssr": "ng run <myproject>:server:dev",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "8.2.12",
"@angular/common": "8.2.12",
"@angular/compiler": "8.2.12",
"@angular/core": "8.2.12",
"@angular/forms": "8.2.12",
"@angular/platform-browser": "8.2.12",
"@angular/platform-browser-dynamic": "8.2.12",
"@angular/platform-server": "8.2.12",
"@angular/router": "8.2.12",
"@nguniversal/module-map-ngfactory-loader": "8.1.1",
"bootstrap": "^4.6.0",
"core-js": "^3.8.3",
"jquery": "^3.5.1",
"node-sass": "^5.0.0",
"oidc-client": "^1.11.3",
"popper.js": "^1.16.0",
"protractor": "~5.4.2",
"rxjs": "^6.6.3",
"ts-node": "~8.4.1",
"tslint": "~5.20.0",
"zone.js": "0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.29",
"@angular/cli": "^8.3.29",
"@angular/compiler-cli": "^8.2.14",
"@angular/language-service": "^8.2.14",
"@types/jasmine": "~3.4.4",
"@types/jasminewd2": "~2.0.8",
"@types/node": "~12.11.6",
"codelyzer": "^5.2.2",
"ini": "^1.3.7",
"jasmine-core": "~3.5.0",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^5.2.3",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage-istanbul-reporter": "~2.1.0",
"karma-jasmine": "~2.0.1",
"karma-jasmine-html-reporter": "^1.5.4",
"typescript": "3.5.3"
},
"optionalDependencies": {
"node-sass": "^5.0.0",
"protractor": "~5.4.2",
"ts-node": "~8.4.1",
"tslint": "~5.20.0"
}
}
Я относительно новичок в Angular, и я буквально понятия не имею, как понять, что отчет пытается сообщить мне о проблеме, не говоря уже о том, как ее исправить. Спасибо!