[英]REACT JEST error Cannot find module 'jest-matchers' from 'jest-expect.js'
When running tests getting the following error: 运行测试时出现以下错误:
Cannot find module 'jest-matchers' from 'jest-expect.js' 无法从'jest-expect.js'找到模块'jest-matchers'
at Resolver.resolveModule (node_modules/jest-resolve/build/index.js:169:17)
Any ideas??? 有任何想法吗???
I'm using: 我正在使用:
node@6.3.1
npm@4.0.5
jest@19.0.2
jest-matchers@19.0.0
您可以尝试在项目的文件夹上运行npm ls
,以查看缺少的依赖项
尝试删除node_modules
文件夹并再次执行npm install
。
Add node_modules
to moduleDirectories
. 将
node_modules
添加到moduleDirectories
。
If you have a jest.config.js add it there, 如果你有一个jest.config.js在那里添加,
// jest.config.js
module.exports = {
verbose: true,
moduleDirectories: ["node_modules"]
};
otherwise should be added to package.json 否则应该添加到package.json
"jest":{
...
"moduleDirectories": ["node_modules"]
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.