reactjs - 在反应应用程序中更新反应脚本后出错
问题描述
在我的节点应用程序中将 react-scripts 升级到 ^3.0.0 后出现此错误 -
FAIL src/components/App/index.test.js
● Test suite failed to run
Cannot find module 'date-fns/addDays' from 'date-fns-utils.js'
However, Jest was able to find:
'./index.css'
'./index.js'
'./index.test.js'
You might want to include a file extension in your import, or update your 'moduleFileExtensions', which is currently ['web.js', 'js', 'web.ts', 'ts', 'web.tsx', 'tsx', 'json', 'web.jsx', 'jsx', 'node'].
See https://jestjs.io/docs/en/configuration#modulefileextensions-array-string
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:230:17)
at Object.<anonymous> (node_modules/material-ui-pickers/utils/date-fns-utils.js:8:39)
我已经手动安装和更新date-fns
了,并且无法找到与此问题直接相关的任何重大更改。(对 npm 很陌生并做出反应)。
解决方案
推荐阅读
- linq - 如何编写实体查询 linq?
- python - 根据字符串位置将 Pandas 系列分成多个 DataFrame 列
- centos7 - 使用 MPDF Centos 7
- python - Python 脚本输出更改取决于我使用的计算机
- python - Django:transaction.atomic的异常后继续执行代码
- android - 无法设置水平线性布局的宽度或垂直线性布局的高度
- php - 更改视图 PHP / CodeIgniter 时会话丢失
- ruby - 从另一个调用一个 jekyll 插件
- bison - Bison shift/reduce 和 reduce/reduce 冲突
- javascript - document.querySelector reading only 1 class