marmelab / react-admin

A frontend Framework for single-page applications on top of REST/GraphQL APIs, using TypeScript, React and Material Design
http://marmelab.com/react-admin
MIT License
24.92k stars 5.24k forks source link

ra-data-simple-rest 5.0.2 produces error when installing packages #9962

Closed jokraehe closed 3 months ago

jokraehe commented 3 months ago

What you were expecting: ra-data-simple-rest uses the same peer-dependency to ra-core as the other packages.

What happened instead:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: ra-data-simple-rest@5.0.2
npm ERR! Found: ra-core@5.0.2
npm ERR! node_modules/ra-core
npm ERR!   ra-core@"^5.0.2" from ra-i18n-polyglot@5.0.2
npm ERR!   node_modules/ra-i18n-polyglot
npm ERR!     ra-i18n-polyglot@"^5.0.2" from react-admin@5.0.2
npm ERR!     node_modules/react-admin
npm ERR!       react-admin@"^5.0.2" from the root project
npm ERR!   ra-core@"^5.0.2" from ra-language-english@5.0.2
npm ERR!   node_modules/ra-language-english
npm ERR!     ra-language-english@"^5.0.2" from react-admin@5.0.2
npm ERR!     node_modules/react-admin
npm ERR!       react-admin@"^5.0.2" from the root project
npm ERR!   2 more (react-admin, ra-ui-materialui)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer ra-core@"^4.0.0" from ra-data-simple-rest@5.0.2
npm ERR! node_modules/ra-data-simple-rest
npm ERR!   ra-data-simple-rest@"^5.0.2" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: ra-core@4.16.19
npm ERR! node_modules/ra-core
npm ERR!   peer ra-core@"^4.0.0" from ra-data-simple-rest@5.0.2
npm ERR!   node_modules/ra-data-simple-rest
npm ERR!     ra-data-simple-rest@"^5.0.2" 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.

Steps to reproduce: Use a package.json with my dependencies and run npm i

"dependencies": {
    "@emotion/react": "^11.11.4",
    "@emotion/styled": "^11.11.4",
    "@fontsource/roboto": "^5.0.13",
    "@mui/material": "^5.15.20",
    "ra-data-simple-rest": "^5.0.2",
    "react": "^18.3.1",
    "react-admin": "^5.0.2",
    "react-dom": "^18.3.1",
    "react-hook-form": "^7.52.0",
    "react-router-dom": "^6.2.1"
  }

Other information:

Environment

fzaninotto commented 3 months ago

Confirmed, thanks for the report!

fzaninotto commented 3 months ago

This will be fixed in the next bugfix release, scheduled for next week.

In the meantime, you can get around this problem by adding --legacy-peer-deps to your npm install command.

jokraehe commented 3 months ago

Thank you for the quick response and workaround! I have modified my package-lock.json to use 5.0.2 as peer-dependency and it works for me until the bugfix release :thumbsup: