简体   繁体   English

找不到模块'@testing-library/react'

[英]Cannot find module '@testing-library/react'

My Test File我的测试文件

package.json file package.json文件

Although I have installed all the necessary dependencies I still get an error when I run npm test尽管我已经安装了所有必要的依赖项,但在运行npm test时仍然出现错误

Cannot find module '@testing-library/react'找不到模块'@testing-library/react'

Add "moduleResolution": "node" in tsconfig.json file.在 tsconfig.json 文件中添加"moduleResolution": "node"

Alternative solution: npm install --save-dev @testing-library/react替代解决方案: npm install --save-dev @testing-library/react

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 无法从“node_modules/@testing-library/react/dist/pure.js”中找到模块“react-dom/client” - Cannot find module 'react-dom/client' from 'node_modules/@testing-library/react/dist/pure.js' 测试失败(测试库/反应):无法找到带有文本的元素: - Failing test (testing-library/react): Unable to find an element with the text: ReactJS:无法加载在“package.json”中声明的插件“testing-library”:找不到模块“./eslint-utils” - ReactJS : Failed to load plugin 'testing-library' declared in 'package.json : Cannot find module './eslint-utils' 使用测试库测试弹出组件以进行反应 - Testing popover components with testing-library for react 在反应测试库中使用 DOM 元素? - Working with DOM elements in react testing-library? @testing-library/react 测试表单 onSubmit - @testing-library/react test form onSubmit 使用 @testing-library/react 测试 antd 下拉列表 - Test antd dropdown with @testing-library/react 无法使用 React 18 和来自 testing-library/react 的 renderHook 测试自定义钩子 - Cannot test custom hooks with React 18 and renderHook from testing-library/react React 测试库:找不到在 .d.ts 中声明的模块 - React testing library: Cannot find module declared in .d.ts 对于异步挂钩,@testing-library/react 中的 function waitForNextUpdate (@testing-library/react-hooks) 有什么替代方案? - What is the alternative the function waitForNextUpdate (@testing-library/react-hooks) in @testing-library/react for async hooks?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM