【问题标题】:React Native 0.60.4 detox postinstall.js install errorReact Native 0.60.4 detox postinstall.js 安装错误
【发布时间】:2023-03-29 02:55:01
【问题描述】:

无法通过npm installyarn 安装排毒。

yarn add --dev detox 将在 postbuild.js 中失败`

这个问题是为了回应 wix/detox 的问题跟踪政策: https://github.com/wix/Detox/issues/1523

按照最新教程开始排毒。

react-native init example // (0.60.4)
brew update
brew tap wix/brew
brew install applesimutils
yarn global add detox-cli // you shouldn't need this
yarn add --dev detox // add this package in /example app

安装 detox 将退出并出现子进程错误。

错误:

Command Failed: <YOUR_PROJECT_PATH>/node_modules/detox/scripts/build_framework.ios.sh
   at checkExecSyncError (child_process.js:629:11)
    at Object.execFileSync (child_process.js:647:13)
    at Object.<anonymous> (<YOUR_PROJECT_PATH>/node_modules/detox/scripts/postinstall.js:2:27)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

在此处遵循他们的指南: https://github.com/wix/Detox/blob/master/docs/Introduction.GettingStarted.md

更新:请参阅下面的解决方案,能够毫无问题地安装 detox。

【问题讨论】:

    标签: react-native detox


    【解决方案1】:

    之前安装的 detox 版本需要 Legacy Build System

    如何正确升级:

    1. 删除 ~/Library/Detox/
    2. 删除 ~/Library/Developer/Xcode/DerivedData/*
    3. yarn add -D detox // 安装时没有问题

    这个问题是怎么发生的:

    如果您安装了依赖于早期 Xcode 的早期版本的 Detox,您将遇到旧版和新构建系统之间的冲突

    然后,Detox 将查看您的 ~/Library/Detox 数据并由于默认选择新构建系统而无法构建

    我通过执行以下操作解决了这个安装错误:

    1. 在 xcode 10.3 中进入 File &gt; Workspace Settings
    2. 共享工作区设置下选择旧版构建系统
    3. 重新安装 detox(它不会使用旧版本并且不会出错)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2016-09-18
      • 2020-11-22
      • 1970-01-01
      • 2022-07-06
      • 2023-01-11
      相关资源
      最近更新 更多