我無法將 ng 引導程式安裝到我的專案中。我不斷收到以下錯誤。
我嘗試運行以下命令,但仍然沒有運氣。
- npm install --legacy-peer-deps
- npm 安裝最新版本
以下是我正在使用的版本:Angular CLI:12.0.3 節點:14.17.5 包管理器:npm 8.3.0
huss@Huss-MacBook-Air huss_web % ng add @ng-bootstrap/ng-bootstrap
您的全域 Angular CLI 版本 (12.2.2) 高于本地版本 (12.0.3)。使用本地 Angular CLI 版本。
要禁用此警告,請使用“ng config -g cli.warnings.versionMismatch false”。? 使用包管理器:npm ? 找到兼容的包版本:@ng-bootstrap/[email protected]。? 已加載包裹資訊。
The package @ng-bootstrap/[email protected] will be installed and executed.
Would you like to proceed? Yes
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected]
npm ERR! node_modules/@angular/compiler
npm ERR! @angular/compiler@"~12.0.3" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/compiler@"12.2.15" from @angular/[email protected]
npm ERR! node_modules/@angular/localize
npm ERR! peer @angular/localize@"^12.0.0" from @ng-bootstrap/[email protected]
npm ERR! node_modules/@ng-bootstrap/ng-bootstrap
npm ERR! @ng-bootstrap/ng-bootstrap@"10.0.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 /Users/hussainsamiwala/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/hussainsamiwala/.npm/_logs/2022-01-05T18_56_39_213Z-debug-0.log
? Package install failed, see above.
hussainsamiwala@Hussains-MacBook-Air huss_web %
我的 package.json 如下:
{
"name": "huss-web",
"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/animations": "~12.0.3",
"@angular/cdk": "^12.1.0",
"@angular/common": "~12.0.3",
"@angular/compiler": "~12.0.3",
"@angular/core": "~12.0.3",
"@angular/forms": "~12.0.3",
"@angular/google-maps": "^12.1.0",
"@angular/material": "^12.1.0",
"@angular/platform-browser": "~12.0.3",
"@angular/platform-browser-dynamic": "~12.0.3",
"@angular/router": "~12.0.3",
"@googlemaps/js-api-loader": "^1.12.1",
"@types/jquery": "^3.5.6",
"angular-ui-bootstrap": "^2.5.6",
"bootstrap": "^5.1.0",
"jquery": "^3.6.0",
"jquery-ui": "^1.13.0",
"latest-version": "^6.0.0",
"rxjs": "~6.6.0",
"tslib": "^2.1.0",
"zone.js": "~0.11.4"
},
"devDependencies": {
"@angular-devkit/build-angular": "~12.0.3",
"@angular/cli": "~12.0.3",
"@angular/compiler-cli": "~12.0.3",
"@types/google.maps": "^3.45.6",
"@types/jasmine": "~3.6.0",
"@types/node": "^12.11.1",
"jasmine-core": "~3.7.0",
"karma": "~6.3.0",
"karma-chrome-launcher": "~3.1.0",
"karma-coverage": "~2.0.3",
"karma-jasmine": "~4.0.0",
"karma-jasmine-html-reporter": "^1.5.0",
"typescript": "~4.2.3"
}
}
uj5u.com熱心網友回復:
嘗試使用--force, 或--legacy-peer-deps
uj5u.com熱心網友回復:
你可以試試這個命令。
npm i @ng-bootstrap/ng-bootstrap
uj5u.com熱心網友回復:
試試這個:
洗掉 node_modules 檔案夾
npm install --force
ng add @ng-bootstrap/ng-bootstrap
轉載請註明出處,本文鏈接:https://www.uj5u.com/ruanti/407023.html
標籤:
