【问题标题】:How can I fix Detox Package subpath './build/cli/args' is not defined by "exports"如何修复 Detox Package 子路径 './build/cli/args' 不是由“exports”定义的
【发布时间】:2021-03-07 05:43:58
【问题描述】:

我正在为 react native 项目设置排毒,我一直在处理配置,当我 sis detox build --configuration android 构建成功但是当我尝试运行 detox test --configuration android 时,我最终会收到以下错误 @ 987654323@

我的.detoxrc.json 文件如下所示:

{
  "testRunner": "jest",
  "runnerConfig": "e2e/config.json",
  "apps": {
    "android": {
      "type": "android.apk",
      "binaryPath": "android/app/build/outputs/apk/debug/app-debug.apk",
      "build": "cd android && ./gradlew assembleDebug assembleAndroidTest -DtestBuildType=debug && cd .."
    }
  },
  "devices": {
    "simulator": {
      "type": "ios.simulator",
      "device": {
        "type": "iPhone 12"
      }
    },
    "emulator": {
      "type": "android.emulator",
      "device": {
        "avdName": "Pixel_3a_API_30_x86"
      }
    }
  },
  "configurations": {
    "ios": {
      "device": "simulator",
      "app": "ios"
    },
    "android": {
      "device": "emulator",
      "app": "android"
    }
  }
}

【问题讨论】:

    标签: react-native detox


    【解决方案1】:

    您的模板声明中有错字。

    变化:

    const referenceTemplate = path.resolve(`.src/templates/reference.js`)
    

    收件人:

    const referenceTemplate = path.resolve(`./src/templates/reference.js`)
    

    此外,您的localizedSlug 函数似乎接收到一些错误的参数。它似乎将isPage 接收为false,将URL 设置为/blog,因此请检查您的查询值。

    【讨论】:

    • 为什么网址显示blog\test-reference
    • localizedSlug 中有一些奇怪的地方。如果不知道那里发送了哪些参数,很难猜测,但可以肯定的是,有问题。尝试在那里调试。
    • 我在问题中添加了本地化的 slug
    • 接收isPage 作为false 返回return isDefault ? /blog/${slug} : /${locale}/blog/${slug} (/blog)
    • 你能调试更多关于那里发生的事情吗?问题应该来自您的查询,因为值是从查询对象传递给函数的。
    猜你喜欢
    • 2022-06-13
    • 2021-12-05
    • 2023-01-23
    • 2021-10-29
    • 2020-10-14
    • 2021-12-28
    • 2022-01-15
    • 1970-01-01
    • 2021-12-31
    相关资源
    最近更新 更多