相关疑难解决方法(0)

错误:jest-haste-map:哈希模块命名冲突:

我创建了一个自定义npm module(将使用xxx代替其名称)并使用手动进行链接npm install

我非常努力地搜寻:

在提出问题之前。如果有人告诉我我的代码或方法有什么问题或代码中的任何错误,我将不胜感激。

当我运行时出现react-native run-android以下错误metro bundler

Error: jest-haste-map: Haste module naming collision:
  Duplicate module name: react-native
  Paths: E:\cdg-native\CDG\node_modules\react-native-XXX\node_modules\react-native\package.json collides with E:\cdg-native\CDG\node_modules\react-native\package.json

This error is caused by `hasteImpl` returning the same name for different files.
Run Code Online (Sandbox Code Playgroud)

我的自定义模块package.json

{
  "name": "react-native-xxx",
  "version": "1.0.0",
  "description": "Library to render xxx",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [ …
Run Code Online (Sandbox Code Playgroud)

android npm react-native npm-install yarnpkg

13
推荐指数
2
解决办法
8218
查看次数

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

当我安装 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)

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

javascript node.js reactjs jestjs react-native

7
推荐指数
1
解决办法
5788
查看次数