Что вызывает ошибку, как установить react pagination?

Что не так, почему ошибка? Как реализовать пагинацию?
Подробности ниже:
$ npm install react-pagination
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @material-ui/core@4.12.4
npm ERR! Found: react@18.2.0
npm ERR! node_modules/react
npm ERR!   peer react@"^16.x || ^17.x || ^18.x" from @pbe/react-yandex-maps@1.2.2
npm ERR!   node_modules/@pbe/react-yandex-maps
npm ERR!     @pbe/react-yandex-maps@"^1.2.2" from the root project
npm ERR!   peer react@"^18.0.0" from @testing-library/react@13.4.0
npm ERR!   node_modules/@testing-library/react
npm ERR!     @testing-library/react@"^13.4.0" from the root project
npm ERR!   8 more (google-map-react, react-dom, react-icons, react-router, ...)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.12.4
npm ERR! node_modules/@material-ui/core
npm ERR!   peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.3
npm ERR!   node_modules/@material-ui/icons
npm ERR!     @material-ui/icons@"^4.11.3" from the root project
npm ERR!   @material-ui/core@"^4.12.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: react@17.0.2
npm ERR! node_modules/react
npm ERR!   peer react@"^16.8.0 || ^17.0.0" from @material-ui/core@4.12.4
npm ERR!   node_modules/@material-ui/core
npm ERR!     peer @material-ui/core@"^4.0.0" from @material-ui/icons@4.11.3
npm ERR!     node_modules/@material-ui/icons
npm ERR!       @material-ui/icons@"^4.11.3" from the root project
npm ERR!     @material-ui/core@"^4.12.4" 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!
npm ERR! For a full report see:
npm ERR! C:\Users\alon3\AppData\Local\npm-cache\_logs\2023-03-16T09_22_53_709Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\alon3\AppData\Local\npm-cache\_logs\2023-03-16T09_22_53_709Z-debug-0.log
  • Вопрос задан
  • 166 просмотров
Пригласить эксперта
Ответы на вопрос 1
TMProject
@TMProject
Frontend developer React/Redux
Ошибка возникает из-за конфликта версий зависимостей. В сообщении об ошибке указаны разные требования к версии React от разных пакетов. Например, пакет @material-ui/core требует React версии "^16.8.0 || ^17.0.0", а пакет react-pagination вероятнее всего требует React версии "^16.8.0 || ^17.0.0 || ^18.0.0". В результате npm не может определить какую версию React использовать и выдает ошибку ERESOLVE.

Вы можете попробовать установить пакет react-pagination с опцией --force, чтобы заставить npm принять неправильное разрешение зависимостей, однако это может привести к другим проблемам в вашем приложении. Лучше всего решить конфликт зависимостей, обновив версии пакетов так, чтобы они использовали совместимые версии React.
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы