teodosii / react-notifications-component

Delightful and highly customisable React Component to notify your users
https://teodosii.github.io/react-notifications-component/
MIT License
1.27k stars 73 forks source link

Unable to resolve dependency tree error when installing npm packages #152

Closed materialsmoke closed 2 years ago

materialsmoke commented 2 years ago

I run npm i react-notifications-component and I coun't install this package on react 18:

I got this error:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: code-challenge-front@0.1.0
npm ERR! Found: react@18.0.0
npm ERR! node_modules/react
npm ERR!   react@"^18.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react@"^17.0.1" from react-notifications-component@3.4.1
npm ERR! node_modules/react-notifications-component
npm ERR!   react-notifications-component@"*" 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 C:\Users\...\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\...\AppData\Local\npm-cache\_logs\2022-04-16T23_00_10_285Z-debug-0.log

my package.json:

{
  "name": "code-challenge-front",
  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@emotion/react": "^11.9.0",
    "@emotion/styled": "^11.8.1",
    "@mui/icons-material": "^5.6.1",
    "@mui/material": "^5.6.1",
    "@mui/styled-engine-sc": "^5.6.1",
    "@testing-library/jest-dom": "^5.16.4",
    "@testing-library/react": "^13.1.1",
    "@testing-library/user-event": "^13.5.0",
    "axios": "^0.26.1",
    "react": "^18.0.0",
    "react-dom": "^18.0.0",
    "react-router-dom": "^6.3.0",
    "react-scripts": "5.0.1",
    "styled-components": "^5.3.5",
    "web-vitals": "^2.1.4"
  },
  "scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },
  "eslintConfig": {
    "extends": [
      "react-app",
      "react-app/jest"
    ]
  },
  "browserslist": {
    "production": [
      ">0.2%",
      "not dead",
      "not op_mini all"
    ],
    "development": [
      "last 1 chrome version",
      "last 1 firefox version",
      "last 1 safari version"
    ]
  }
}
teodosii commented 2 years ago

Hello, thanks for reporting. Yes, I believe the syntax ^17.0.1 does not allow 18.0.0, I will probably need to republish a new version that has 18.0.0 as peer dependency.

Loque18 commented 2 years ago

Hello, thanks for reporting. Yes, I believe the syntax ^17.0.1 does not allow 18.0.0, I will probably need to republish a new version that has 18.0.0 as peer dependency.

Hello, Yes please, I am also facing this issue, I had to go back to react 17 to make the package work

teodosii commented 2 years ago

Updated package to 4.0.0 and changed the peer dependency.

GantaVenkataKousik commented 8 months ago

The same problem,How can I solve this The error you're encountering is due to version conflicts between dependencies in your project. The react-toast-notifications package has specified that it requires React version ^16.8.0 || ^17.0.0, but your project is currently using React version 18.2.0.

![Uploading Screenshot 2024-02-02 221902.png…]()