React Native 0.60.4 detox postinstall.js 安装错误

fen*_*rdt 3 react-native detox

无法通过npm install或安装 detox yarn

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

Run Code Online (Sandbox Code Playgroud)

安装 detox 将退出并显示 childprocess 错误。

错误:

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)
Run Code Online (Sandbox Code Playgroud)

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

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

fen*_*rdt 6

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

如何正确升级:

  1. 删除 ~/Library/Detox/
  2. 删除 ~/Library/Developer/Xcode/DerivedData/*
  3. yarn add -D detox // 不安装并发出

这个问题是怎么出现的:

如果您安装了依赖于早期 Xcode 的早期版本的 Detox,您将在Legacy 和 New Build System之间发生冲突。

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

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

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