提问人:z123 提问时间:11/11/2023 更新时间:11/12/2023 访问量:44
Angular 11 不适用于任何版本的 ngx 棋盘,但与 @angular/cdk 配合良好:“^12.2.9”,
Angular 11 not working with any version of ngx chess-board but worked fine with @angular/cdk: "^12.2.9",
问:
我有angular ngx-chess-board工作,但现在当我尝试使用angular 11运行它时,我收到版本不兼容的错误。ngx-chess-board 支持 cdk 10 或 13 版本,但我使用的是 11。我已经尝试了所有版本的 ngx-chess-board,但无法获得任何版本来与我的 cdk 版本一起使用。
该项目在 cdk 版本 “@angular/cdk”: “^12.2.9” 上运行良好,但所有其他软件包都使用 angular 11,因此需要 angular cdk 版本 11。有什么方法可以解决这个问题或同时满足这两个问题吗?
我收到以下错误:
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/cdk
npm ERR! @angular/cdk@"^11.0.6" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer @angular/cdk@"^10.2.5" from [email protected]
npm ERR! node_modules/ngx-chess-board
npm ERR! ngx-chess-board@"2.1.18" 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.
我package.json是:
{
"name": "DineNGo",
"version": "2.0.0",
"browser": {
"fs": false,
"path": false,
"os": false
},
"scripts": {
"ng": "ng",
"main": "server.js",
"heroku-postbuild": "ng build --aot --configuration=${ENV}",
"preinstall": "npm install -g @angular/cli @angular/compiler-cli --legacy-peer-deps",
"start": "ng serve",
"cypress:open": "cypress open",
"cypress:run": "cypress run",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular-devkit/build-angular": "^0.1102.19",
"@angular/animations": "^11.0.6",
"@angular/cdk": "^11.0.6",
"@angular/cli": "^11.0.6",
"@angular/common": "^11.0.6",
"@angular/compiler": "^11.0.6",
"@angular/compiler-cli": "^11.0.6",
"@angular/core": "^11.0.6",
"@angular/flex-layout": "^11.0.0-beta.33",
"@angular/forms": "^11.0.6",
"@angular/language-service": "^11.0.6",
"@angular/localize": "^11.0.6",
"@angular/material": "^11.0.6",
"@angular/platform-browser": "^11.0.6",
"@angular/platform-browser-dynamic": "^11.0.6",
"@angular/router": "^11.0.6",
"@ng-bootstrap/ng-bootstrap": "9.0.2",
"@ngtools/webpack": "^11.0.0",
"@ngx-translate/core": "13.0.0",
"@ngx-translate/http-loader": "^4.0.0",
"@types/chart.js": "^2.7.42",
"@types/chartist": "^0.9.38",
"@types/crypto-js": "^3.1.47",
"@types/express": "^4.17.0",
"@types/jasmine": "~2.8.6",
"@types/jasminewd2": "~2.0.3",
"@types/lodash": "4.14.135",
"@types/node": "^11.15.54",
"@types/socket.io": "^3.0.2",
"@types/socket.io-client": "^3.0.0",
"@types/uuid": "^8.3.0",
"@types/w3c-web-usb": "^1.0.4",
"@types/web-bluetooth": "0.0.4",
"angular-bootstrap-md": "^11.1.0",
"angular-cc-library": "^2.1.2",
"angular-cli-ghpages": "^0.6.2",
"angular-notifier": "^9.1.0",
"angular-responsive-carousel": "^2.0.2",
"angularx-qrcode": "^11.0.0",
"apexcharts": "^3.25.0",
"axios": "^1.3.6",
"bcryptjs": "^2.4.3",
"body-parser": "^1.18.3",
"bootstrap": "^4.5.3",
"chart.js": "^2.9.4",
"chartist": "^0.11.4",
"config": "^3.3.6",
"core-js": "^2.5.4",
"cors": "^2.8.5",
"crypto": "^1.0.1",
"crypto-js": "^3.3.0",
"css-loader": "^2.1.0",
"dotenv": "^6.1.0",
"exec": "^0.2.1",
"express": "^4.18.1",
"express-jwt": "^7.7.5",
"font-awesome": "^4.7.0",
"fontawesome": "^5.6.3",
"fs": "^0.0.1-security",
"got": "^11.8.1",
"hammerjs": "^2.0.8",
"jsonwebtoken": "^8.2.2",
"jwt-decode": "^3.1.2",
"lodash": "4.17.11",
"lz-string": "^1.5.0",
"material-dashboard": "^2.1.0",
"material-design-icons": "^3.0.1",
"material-design-lite": "^1.3.0",
"mdbootstrap": "^4.19.2",
"mongodb": "^3.0.10",
"mongoose": "^5.1.4",
"ng-apexcharts": "1.5.12",
"ng-chartist": "^4.1.0",
"ng-multiselect-dropdown": "^0.2.14",
"ng-socket-io": "^0.2.4",
"ngx-autosize": "^1.8.4",
"ngx-bootstrap": "^6.2.0",
"ngx-chess-board": "2.1.18",
"ngx-device-detector": "^2.0.0",
"ngx-guided-tour": "^1.1.11",
"ngx-swiper-wrapper": "^10.0.0",
"openai": "^4.15.0",
"path": "^0.12.7",
"popper.js": "^1.15.0",
"postcss": "^8.4.14",
"protractor": "^7.0.0",
"remote-pay-cloud": "4.1.1",
"remote-pay-cloud-api": "4.0.4",
"request": "^2.88.2",
"request-promise": "^4.2.4",
"resize-base64": "^1.0.12",
"rootpath": "^0.1.2",
"rxjs": "^6.5.2",
"rxjs-compat": "^6.3.3",
"socket.io": "^4.6.2",
"socket.io-client": "^4.6.2",
"time-ago-pipe": "^1.3.2",
"ts-node": "6.0.0",
"tslib": "^1.9.0",
"typescript": "4.0.5",
"uuid": "^3.3.2",
"web-animations-js": "^2.3.2",
"zone.js": "~0.10.3"
},
"devDependencies": {
"@angular-devkit/core": "^11.0.0",
"@angular-devkit/schematics": "^11.0.0",
"codelyzer": "^6.0.2",
"cypress": "^9.7.0",
"cypress-cucumber-preprocessor": "^4.3.1",
"cypress-multi-reporters": "^1.6.0",
"eslint-plugin-cypress": "^2.10.3",
"express-jwt": "^7.7.5",
"jasmine-core": "~2.99.1",
"jasmine-spec-reporter": "~4.2.1",
"karma": "^6.4.0",
"karma-chrome-launcher": "~2.2.0",
"karma-coverage-istanbul-reporter": "~2.0.0",
"karma-jasmine": "~1.1.1",
"karma-jasmine-html-reporter": "^0.2.2",
"ng2-charts-schematics": "^0.1.7",
"protractor": "^7.0.0",
"swiper": "^6.8.4",
"tslint": "~6.1.3"
},
"engines": {
"node": "16.16.0",
"npm": "8.11.0"
}
}
答:
0赞
The Fabio
11/12/2023
#1
查看错误,您在 @angular/cdk 软件包版本上与 ngx-chess-board 版本存在依赖冲突:
npm ERR! While resolving: [email protected]
npm ERR! Found: @angular/[email protected] <<< HERE
...
npm ERR! peer @angular/cdk@"^10.2.5" <<< HERE
npm ERR! node_modules/ngx-chess-board
npm ERR! ngx-chess-board@"2.1.18" from the root project
查看 ngx-chess-board 存储库,版本 2.1.8,我们可以看到它与 @angular/cdk@“^10.2.5 (angular 10.x) 兼容
看起来 ngx-chess-board 没有与 angular 11.x 兼容的版本。(至少不在他们的 repo 标签上)
我建议您将应用程序升级到 angular 13.x,以便您可以使用最新版本的 ngx-chess-board(截至撰写本文时为 v2.2.3),因为它与 angular 13.x 兼容
或者,您可以使用 ngx-chess-board 中的此提交,因为它似乎与 angular 11 兼容。
评论
0赞
z123
11/12/2023
如何使用该提交?
0赞
The Fabio
11/12/2023
您可以使用其他答案来指导您如何操作
0赞
z123
11/13/2023
嘿,我按照您提供的示例为该提交添加了以下依赖项,但我仍然收到错误"ngx-chess-board":"git+https://github.com/grzegorz103/ngx-chess-board.git#e010df3"
import {NgxChessBoardModule} from 'ngx-chess-board';
0赞
The Fabio
11/13/2023
导入有什么错误?
0赞
z123
11/15/2023
我成功导入了包,但是当我导入到应用程序模块时,包名称是 as 而不是 and there,我收到 NgxChessBoardModule not found 错误。ngx
ngx-chess-board
NgxChessBoardModule.forRoot()
评论