0

I'm using React Material UI and I get this error : Module not found: Can't resolve '@date-io/date-fns'.

Here are the dependencies that I have in my package.json file :

  "version": "0.1.0",
  "private": true,
  "dependencies": {
    "@material-ui/core": "^4.12.1",
    "@material-ui/icons": "^4.11.2",
    "@material-ui/pickers": "^3.3.10",
    "@testing-library/jest-dom": "^5.11.8",
    "@testing-library/react": "^11.2.2",
    "@testing-library/user-event": "^12.6.0",
    "antd": "^4.16.6",
    "axios": "^0.21.1",
    "bootstrap": "^4.5.3",
    "query-string": "^4.3.4",
    "react": "^17.0.1",
    "react-bootstrap": "^1.4.0",
    "react-dom": "^17.0.1",
    "react-owl-carousel": "^2.3.3",
    "react-router-dom": "^5.2.0",
    "react-script-tag": "^1.1.2",
    "react-scripts": "4.0.1",
    "react-seat-picker": "^1.5.3",
    "react-tooltip": "^4.2.21",
    "web-vitals": "^0.2.4"
  },

I tried installing these libraries but it keeps showing errors in command prompt

D:\WebSites\site>npm i --save date-fns@next @date-io/date-fns
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: site@0.1.0
npm ERR! Found: date-fns@2.0.0-beta.5
npm ERR! node_modules/date-fns
npm ERR!   date-fns@"2.0.0-beta.5" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peerOptional date-fns@"^2.0.0" from @date-io/date-fns@2.11.0
npm ERR! node_modules/@date-io/date-fns
npm ERR!   @date-io/date-fns@"*" 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\Ryan\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\Ryan\AppData\Local\npm-cache\_logs\2021-08-11T12_31_59_156Z-debug.log
Ryan Fonseka
  • 233
  • 5
  • 20

1 Answers1

1

Install this package works for me.

date-fns

npm i date-fns
Meir As
  • 11
  • 2