在React-Native项目中开玩笑.如何列出或删除重复的模块?

我正在尝试使用lerna设置React-Native项目.当我尝试运行jest时,我面临以下错误.

   The name `setupDevtools` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or packages, that provide a module for that particular name and platform. The platform is generic (no extension). You must delete or blacklist files until there remains only one of these:

      * `/Users/kevin.amiranoff/project/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
      * `/Users/kevin.amiranoff/project/packages/App/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
      * `/Users/kevin.amiranoff/project/packages/App-exceptions/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
      * `/Users/kevin.amiranoff/project/packages/App-signin/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
      * `/Users/kevin.amiranoff/project/packages/App-ui/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
      * `/Users/kevin.amiranoff/project/packages/App-utils/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)

这是我的root包中的jest配置.json

"jest": {
    "preset": "react-native",
    "globals": {
      "__DEV__": true
    },
    "testRegex": "packages/(.*)/src/(.*)/__tests__/(.*).js?$",
    "transformIgnorePatterns": [
      "packages/(.*)/node_modules/?!(react|react-native)"
         ],
    "testEnvironment": "node"
  }

任何人都可以向我解释一下,我必须忽略什么,以及如何?

最佳答案
您应该使用modulePathIgnorePatterns忽略某些目录.
确保只有您真正想要使用的那个不在此忽略列表中.

链接到文档:
https://facebook.github.io/jest/docs/en/configuration.html#modulepathignorepatterns-array-string

转载注明原文:在React-Native项目中开玩笑.如何列出或删除重复的模块? - 代码日志