javascriptreactjsnpmnext.jsmantine

How to resolve this 'code ERESOLVE npm ERR! ERESOLVE could not resolve' & 'peer dependency' errors


I want to have a website to give distance training, so I'm considering that and for quite a few days I've had this error, I searched a lot on several forums, but the solutions are not adapted to my reality. I just asked you to help me to have the site live on Vercel.

First, I would like to thank you for each response.

enter image description here

code ERESOLVE npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: @mantine/rte@5.10.5 npm ERR! Found: @mantine/core@6.0.21 npm ERR! node_modules/@mantine/core
npm ERR!
@mantine/core@"^6.0.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency: npm ERR! peer @mantine/core@"5.10.5" from @mantine/rte@5.10.5 npm ERR! node_modules/@mantine/Ite
nom ERR!
@mantine/rte@"^5.10.5" from the root project
npm ERR! npm ERR! Conflicting peer dependency: @mantine/core@5.10.5
npm ERR!
node_modules/@mantine/core
npm ERR!
peer @mantine/core@"5.10.5" from @mantine/rte@5.10.5
npm ERR!
node_modules/@mantine/rte
npm ERR!
@mantine/rte@"^5.10.5" from the root project

Locally everything works very well, but I always got this message during deployment on Vercel, look at my package.json file.

    {
  "name": "elearniv",
  "version": "1.4.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start",
    "lint": "next lint",
    "model:generate": "env-cmd sequelize-cli model:generate",
    "seed:generate": "env-cmd sequelize-cli seed:generate",
    "seed": "env-cmd sequelize-cli db:seed:all",
    "migrate": "env-cmd sequelize-cli db:migrate",
    "migrate:rollback": "env-cmd sequelize-cli db:migrate:undo",
    "migrate:rollback:all": "env-cmd sequelize-cli db:migrate:undo:all"
  },
  "dependencies": {
    "@emotion/react": "^11.11.3",
    "@etchteam/next-pagination": "^3.5.4",
    "@mantine/core": "^6.0.0",
    "@mantine/hooks": "^6.0.0",
    "@mantine/rte": "^5.10.5",
    "axios": "^1.6.7",
    "bcrypt": "^5.0.1",
    "framer-motion": "^7.3.4",
    "fslightbox-react": "^1.6.2-2",
    "html-to-image": "^1.10.8",
    "js-cookie": "^3.0.1",
    "jsonwebtoken": "^9.0.2",
    "jspdf": "^2.5.1",
    "mysql2": "^2.3.3",
    "next": "^14.1.0",
    "nodemailer": "^6.7.7",
    "nookies": "^2.5.2",
    "nprogress": "^0.2.0",
    "react": "^18.2.0",
    "react-accessible-accordion": "^5.0.0",
    "react-confirm-alert": "^3.0.6",
    "react-dom": "18.2.0",
    "react-hot-toast": "^2.3.0",
    "react-jutsu": "^3.0.3",
    "react-loading-skeleton": "^3.1.0",
    "react-redux": "^8.0.2",
    "react-sticky-box": "^1.0.2",
    "react-stripe-checkout": "^2.6.3",
    "react-tabs": "^6.0.0",
    "redux": "^4.2.0",
    "redux-devtools-extension": "^2.13.9",
    "redux-thunk": "^2.4.1",
    "sass": "^1.54.0",
    "save": "^2.9.0",
    "sequelize": "^6.21.3",
    "stripe": "^10.2.0",
    "swiper": "^9.1.1",
    "uuid": "^8.3.2",
    "uuid-validate": "^0.0.3"
  }
  
}

I've had this error for 4 days, I've been doing research so far I can't find a solution.


Solution

  • Explanation

    If you create a project in a separate folder with npm init, run npm i @mantine/rte@5.10.5 and open your package-lock.json, you would see in its peerDependencies the following

    "peerDependencies": {
      "@mantine/core": "5.10.5",
      "@mantine/hooks": "5.10.5",
      "react": ">=16.8.0",
      "react-dom": ">=16.8.0"
    }
    

    It means that for @mantine/rte@5.10.5 to work, your project needs @mantine/core@5.10.5 and currently you have @mantine/core@6.0.0. This is the problem.

    You have the same issue between react, where you have version 18 and react-jutsu expects for versions 15.0.0, 16.0.0 or 17.0.0.

    Solution

    You need to uninstall all these conflicting libraries and re-install them accordingly:

    npm un @mantine/core @mantine/rte @mantine/hooks react-jutsu
    

    Then install @mantine version 5.10.5:

    npm i @mantine/core@5.10.5 @mantine/rte@5.10.5 @mantine/hooks@5.10.5
    

    Same thing, to be able to install react-jutsu, you need to downgrade react and react-dom to 17 or something. I would search for an equivalent library that supports React 18, or file an issue on their GitHub, instead of downgrading React, since you are using Next.js 14.