本文介绍了找不到模块:无法解析';@date-io/date-fns';的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用React Material UI,我收到此错误:找不到模块:无法解析‘@date-io/date-fns’。
以下是我的Package.json文件中的依赖项:
"dependencies": {
"@date-io/date-fns": "^2.0.0",
"@material-ui/core": "^4.9.5",
"@material-ui/pickers": "^3.2.10",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.5.0",
"@testing-library/user-event": "^7.2.1",
"axios": "^0.19.2",
"date-fns": "^2.0.0",
"react": "^16.13.0",
"react-dom": "^16.13.0",
"react-facebook-login": "^4.1.1",
"react-google-login": "^5.1.14",
"react-google-maps": "^9.4.5",
"react-hook-form": "^5.2.0",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0"
},
我尝试安装最新版本的date-io/date-fns,然后尝试版本2.0.0和版本1.0.0,但仍然收到相同的错误。
推荐答案
$ npm i --save date-fns@next @date-io/[email protected]
参考资料:
https://github.com/mui-org/material-ui-pickers/issues/240
https://github.com/dmtrKovalenko/date-io/issues/33
引用:https://material-ui-pickers.dev/getting-started/installation#peer-library
npm i @date-io/[email protected] date-fns
// or
npm i @date-io/[email protected] moment
// or
npm i -s @date-io/[email protected] luxon
// or
npm i -s @date-io/[email protected] dayjs
这篇关于找不到模块:无法解析';@date-io/date-fns';的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!