如何修复 React Native 错误“jest-haste-map:Haste 模块命名冲突”?

Jin*_*Jin 7 javascript node.js reactjs jestjs react-native

当我安装 react-native-popup-menu 时,我遇到了这样的错误。

这是错误代码


E:\react-native\.. 中寻找 JS 文件

正在加载依赖图...(节点:9460)UnhandledPromiseRejectionWarning:错误:jest-haste-map:Haste 模块命名冲突:重复模块名称:react-native 路径:E:\react-native\........ .....\node_modules\react-native-twitter-signin\node_modules\react-native\package.json 与 E:\react-native\................\node_modules\ 发生冲突react-native\package.json

这个错误是由 hasteImpl为不同的文件返回相同的名称。在 setModule (E:\react-native\................\node_modules\jest-haste-map\build\index.js:551:17) 在 workerReply (E:\react- native\................\node_modules\jest-haste-map\build\index.js:613:9) 在 process._tickCallback (internal/process/next_tick.js:68:7 ) (node:9460) UnhandledPromiseRejectionWarning:未处理的承诺拒绝。这个错误要么是因为在没有 catch 块的情况下抛出了异步函数,要么是因为拒绝了一个没有用 .catch() 处理过的承诺。(rejection id: 2) (node:9460) [DEP0018] DeprecationWarning:不推荐使用未处理的承诺拒绝。将来,未处理的承诺拒绝将使用非零退出代码终止 Node.js 进程。(节点:9460)未处理的PromiseRejectionWarning:错误:jest-haste-map:

此错误是由hasteImpl为不同文件返回相同名称引起的。在 setModule (E:\react-native\................\node_modules\jest-haste-map\build\index.js:551:17) 在 workerReply (E:\react- native\................\node_modules\jest-haste-map\build\index.js:613:9) 在 process._tickCallback (internal/process/next_tick.js:68:7 ) (node:9460) UnhandledPromiseRejectionWarning:未处理的承诺拒绝。这个错误要么是因为在没有 catch 块的情况下抛出了异步函数,要么是因为拒绝了一个没有用 .catch() 处理过的承诺。(拒绝编号:3)

我试图找到解决此错误的方法,但找不到任何解决方案。

Lua*_*ius 1

我遇到了这个问题,我创建了源文件的备份并删除了整个文件夹的所有内容。删除 node_modules 还不够。取回文件并使用 npm install 来安装软件包后,它就起作用了。