Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ERESOLVE unable to resolve dependency tree on nextjs and reactjs 18.2.0 #409

Open
daneseuwu opened this issue Apr 10, 2023 · 3 comments
Open

Comments

@daneseuwu
Copy link

daneseuwu commented Apr 10, 2023

npm install --save react-lazyload
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: [email protected]
npm ERR! Found: [email protected]
npm ERR! node_modules/react
npm ERR! react@"18.2.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^0.14.0 || ^15.0.0 || ^16.0.0 || ^17.0.0" from [email protected]
npm ERR! node_modules/react-lazyload
npm ERR! react-lazyload@"*" 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\user\AppData\Local\npm-cache_logs\2023-04-10T09_21_34_159Z-eresolve-report.txt

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Local\npm-cache_logs\2023-04-10T09_21_34_159Z-debug-0.log

@ruben-martin-lozano
Copy link

#380 (comment)

@zxq08
Copy link

zxq08 commented Aug 25, 2023

#380 (comment)

I get, but what gives me trouble is that npm package isn't updated yet

@kyoungholee
Copy link

This means that react-lazyload is defined to be compatible with earlier versions of react (0.14.0, 15.x, 16.x, 17.x).

To solve this problem, you can try the following methods:

  1. using the legacy-peer-defs option
    With this option, npm ignores incompatible peer dependencies and attempts to install them. This is one of the simplest solutions.

npm install --save react-lazyload --legacy-peer-deps

  1. --using the force option
    This option ignores any conflicts that occur during the installation process and forces the installation to proceed. However, this method should be used carefully as it can potentially result in broken dependencies.

npm install --save react-lazyload --force

  1. Use compatible libraries
    You can use another library that is compatible with React 18 instead of React-lazyload. For example, you can use libraries such as React-lazy-load-image-component or React-intersection-observor.

react-lazy-load-image-component

npm install --save react-lazy-load-image-component

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants