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: [email protected]
npm ERR! Found: [email protected]
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/[email protected]
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
5
  • 1
    I think it's repeated question chek here link Aug 11, 2021 at 12:41
  • 1
    remove node module and package-lock.json file and try again Aug 11, 2021 at 12:56
  • @Kantivekariya in my case, I don't have this dependency "@date-io/date-fns": "^2.0.0", what should I do? Aug 12, 2021 at 6:10
  • 1
    you are welcome @Ryan Fonseka Aug 12, 2021 at 14:36
  • @Kantivekariya can you please put this as an answer? Aug 15, 2021 at 8:09

1 Answer 1

1

Install this package works for me.

date-fns

npm i date-fns

Your Answer

Reminder: Answers generated by Artificial Intelligence tools are not allowed on Stack Overflow. Learn more

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.