Detox: Postinstall installation error build_framework.ios.sh

Created on 20 Dec 2018  ·  26Comments  ·  Source: wix/Detox

Description

In my React Native project, I get an when error trying to install Detox with yarn add detox --dev.

Steps to Reproduce

This is my first time installing Detox. I have seen others report similar issues, I am using the latest version of Detox.

Detox, Node, Device, Xcode and macOS Versions

  • Detox: 9.1.2
  • React Native: 0.57.7
  • Node: 10.14.1
  • Device: iPhone X, simulator
  • Xcode: 10.1
  • macOS: macOS Mojave 10.14.2

Device and verbose Detox logs

error /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox: Command failed.
Exit code: 1
Command: node scripts/postinstall.js
Arguments:
Directory: /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox
Output:
+ xcodebuild -version
+++ dirname /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/scripts/build_framework.ios.sh
++ dirname /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/scripts
+ detoxRootPath=/Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox
++ node -p 'require('\''/Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/package.json'\'').version'
+ detoxVersion=9.1.2
++ echo 9.1.2
++ xcodebuild -version
++ shasum
++ awk '{print $1}'
+ sha1=aec62188116fcc095542b8295542435cd5c8a400
+ detoxFrameworkDirPath=/Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400
+ detoxFrameworkPath=/Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400/Detox.framework
+ main
+ '[' -d /Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400 ']'
+ prepareAndBuildFramework
+ '[' -d /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios ']'
+ detoxSourcePath=/Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ extractSources /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ detoxSourcePath=/Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ echo 'Extracting Detox sources...'
Extracting Detox sources...
+ mkdir -p /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ tar -xjf /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/Detox-ios-src.tbz -C /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ buildFramework /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ detoxSourcePath=/Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ echo 'Building Detox.framework from /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src...'
+ mkdir -p /Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400
Building Detox.framework from /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src...
+ /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/scripts/build_universal_framework.sh /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src/Detox.xcodeproj /Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400
child_process.js:632
    throw err;
    ^

Error: Command failed: /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/scripts/build_framework.ios.sh
    at checkExecSyncError (child_process.js:611:11)
    at Object.execFileSync (child_process.js:629:13)
    at Object.<anonymous> (/Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/scripts/postinstall.js:2:27)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)

acceptebug ios

Most helpful comment

🤦‍♂️

All 26 comments

Run /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/scripts/build_framework.ios.sh separately, what's the output?

Run /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/scripts/build_framework.ios.sh separately, what's the output?

+ xcodebuild -version
+++ dirname /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/scripts/build_framework.ios.sh
++ dirname /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/scripts
+ detoxRootPath=/Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox
++ node -p 'require('\''/Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/package.json'\'').version'
+ detoxVersion=9.1.2
++ echo 9.1.2
++ xcodebuild -version
++ shasum
++ awk '{print $1}'
+ sha1=aec62188116fcc095542b8295542435cd5c8a400
+ detoxFrameworkDirPath=/Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400
+ detoxFrameworkPath=/Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400/Detox.framework
+ main
+ '[' -d /Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400 ']'
+ '[' '!' -d /Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400/Detox.framework ']'
+ echo '/Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400 was found, but could not find Detox.framework inside it. This means that the Detox framework build process was interrupted.
         deleting /Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400 and trying to rebuild.'
/Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400 was found, but could not find Detox.framework inside it. This means that the Detox framework build process was interrupted.
         deleting /Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400 and trying to rebuild.
+ rm -rf /Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400
+ prepareAndBuildFramework
+ '[' -d /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios ']'
+ detoxSourcePath=/Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ extractSources /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ detoxSourcePath=/Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ echo 'Extracting Detox sources...'
Extracting Detox sources...
+ mkdir -p /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ tar -xjf /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/Detox-ios-src.tbz -C /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ buildFramework /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ detoxSourcePath=/Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src
+ echo 'Building Detox.framework from /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src...'
Building Detox.framework from /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src...
+ mkdir -p /Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400
+ /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/scripts/build_universal_framework.sh /Users/praveen/Documents/coding/react/BarsAppAmplify/node_modules/detox/ios_src/Detox.xcodeproj /Users/praveen/Library/Detox/ios/aec62188116fcc095542b8295542435cd5c8a400

@rotemmiz I have been experiencing this issue too.

install:

Output:
+ xcodebuild -version
+++ dirname /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/scripts/build_framework.ios.sh
++ dirname /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/scripts
+ detoxRootPath=/Users/brsmith/Development/adhd/hcs-x01/node_modules/detox
++ node -p 'require('\''/Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/package.json'\'').version'
+ detoxVersion=10.0.2
++ echo 10.0.2
++ xcodebuild -version
++ shasum
++ awk '{print $1}'
+ sha1=680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f
+ detoxFrameworkDirPath=/Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f
+ detoxFrameworkPath=/Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f/Detox.framework
+ main
+ '[' -d /Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f ']'
+ prepareAndBuildFramework
+ '[' -d /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios ']'
+ detoxSourcePath=/Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ extractSources /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ detoxSourcePath=/Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ echo 'Extracting Detox sources...'
Extracting Detox sources...
+ mkdir -p /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ tar -xjf /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/Detox-ios-src.tbz -C /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ buildFramework /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ detoxSourcePath=/Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ echo 'Building Detox.framework from /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src...'
Building Detox.framework from /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src...
+ mkdir -p /Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f
+ /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/scripts/build_universal_framework.sh /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src/Detox.xcodeproj /Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f
child_process.js:630
    throw err;
    ^

Error: Command failed: /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/scripts/build_framework.ios.sh
    at checkExecSyncError (child_process.js:607:13)
    at Object.execFileSync (child_process.js:627:13)
    at Object.<anonymous> (/Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/scripts/postinstall.js:2:27)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)

xcode-select path
/Applications/Xcode.app/Contents/Developer

when I run this directly:

hcs-x01 brsmith$  /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/scripts/build_framework.ios.sh
+ xcodebuild -version
+++ dirname /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/scripts/build_framework.ios.sh
++ dirname /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/scripts
+ detoxRootPath=/Users/brsmith/Development/adhd/hcs-x01/node_modules/detox
++ node -p 'require('\''/Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/package.json'\'').version'
+ detoxVersion=10.0.2
++ echo 10.0.2
++ xcodebuild -version
++ shasum
++ awk '{print $1}'
+ sha1=680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f
+ detoxFrameworkDirPath=/Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f
+ detoxFrameworkPath=/Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f/Detox.framework
+ main
+ '[' -d /Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f ']'
+ '[' '!' -d /Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f/Detox.framework ']'
+ echo '/Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f was found, but could not find Detox.framework inside it. This means that the Detox framework build process was interrupted.
         deleting /Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f and trying to rebuild.'
/Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f was found, but could not find Detox.framework inside it. This means that the Detox framework build process was interrupted.
         deleting /Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f and trying to rebuild.
+ rm -rf /Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f
+ prepareAndBuildFramework
+ '[' -d /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios ']'
+ detoxSourcePath=/Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ extractSources /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ detoxSourcePath=/Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ echo 'Extracting Detox sources...'
Extracting Detox sources...
+ mkdir -p /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ tar -xjf /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/Detox-ios-src.tbz -C /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ buildFramework /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ detoxSourcePath=/Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src
+ echo 'Building Detox.framework from /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src...'
Building Detox.framework from /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src...
+ mkdir -p /Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f
+ /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/scripts/build_universal_framework.sh /Users/brsmith/Development/adhd/hcs-x01/node_modules/detox/ios_src/Detox.xcodeproj /Users/brsmith/Library/Detox/ios/680bbde0ab5eb3ab73f26379f7c34e297d4c3a2f

When I run build_framework.ios.sh it seems to work but it will still not build and run the tests? I have tried uninstalling detox etc but had no luck.

OSX 10.14
xCode Version 10.1 (10B61)

The issue was caused in my case by running multiple versions of xCode. To see the real issue I had to manually build detox from that point I could see the failure.

It was fixed by https://stackoverflow.com/questions/39635735/swift-does-not-support-the-sdk-iphonesimulator9-3-sdk

I have same issue

Detox 10.0.7
OSX 10.14
xCode Version 10.1 (10B61)

Found in $HOME/Library/Detox/ios/${sha1}/detox_ios.log error

node_modules/detox/ios_src/Detox/DTXMethodInvocation.m:11:9: fatal error: 'EarlGrey/GreyActions.h' file not found
#import <EarlGrey/GreyActions.h>
        ^~~~~~~~~~~~~~~~~~~~~~~~

🤔

changes added here https://github.com/wix/Detox/commit/6a1d700eac0d2f84294e30b4fd18776db4d604df#diff-5ee60c03716db19817f236ea45a7a851R11

how to fix this?

I have the same error.
v10.0.5 was installed correctly
v10.0.7 couldn't install

i also have this error in earlier versions of detox.
Maybe because of the react-native version?

Same here .. when Detox tries to setup it seems like it's unable to build the Detox.framework in ~/Library/Detox/ios/<hash>/Detox.framework
and the hash folder instead contains a log file.

xcode version: Version 10.1 (10B61)

Same error, cannot run the examples. How can we fix this?

+1

We seem to have found the issue, this only happens on machines with case sensitive file system.
https://github.com/wix/Detox/commit/6a1d700eac0d2f84294e30b4fd18776db4d604df#diff-5ee60c03716db19817f236ea45a7a851R11 is now being fixed,
#import <EarlGrey/GreyActions.h> -> #import <EarlGrey/GREYActions.h>

🤦‍♂️

hmm, i still have this.

With what version do you still have the issue @svenjens ?

@rdewolff 10.0.10. in which it should be fixed.

Guys, please reopen the issue.

Please post the log.

That was fast 👍

Upload the detox build log, not the npm install log. $HOME/Library/Detox/ios/${sha1}/detox_ios.log

it gives me 21 times

/Users/svenjens/Apps/ober-app/node_modules/detox/ios_src/Detox/WXJSTimerObservationIdlingResource.h:10:9: fatal error: 'EarlGrey/EarlGrey.h' file not found
#import <EarlGrey/EarlGrey.h>
        ^~~~~~~~~~~~~~~~~~~~~
1 error generated.

Do you need to whole log ?

The following files:
TestFailureHandler.h:10:9:
WebSocket.m:10:9
WXRunLoopIdlingResource.h:10:9:
EarlGreyExtensions.h:9:9:
EarlGrey+Detox.h:10:9
GREYMatchers+Detox.h:9:9:
TestFailureHandler.h:10:9:
DTXMethodInvocation.m:10:9:
GREYCondition+Detox.h:9:9
WXRNLoadIdlingResource.h:10:9:
WXAnimatedDisplayLinkIdlingResource.h:10:9
GREYConfiguration+Detox.h:9:9:

DetoxAppDelegateProxy.m:13:9: fatal error: module 'COSTouchVisualizer' not found
@import COSTouchVisualizer;

Please post the entire log. Make sure to clear $HOME/Library/Detox/ first, then try to npm install where Detox fails and provide the entire log created at $HOME/Library/Detox/ios/${sha1}/detox_ios.log.

The whole log, its big:

https://justpaste.it/3rmj6

This looks unrelated to this issue. Please open a new one and attach that log. Thanks

Was this page helpful?
0 / 5 - 0 ratings

Related issues

alexmngn picture alexmngn  ·  3Comments

raphkr picture raphkr  ·  4Comments

rikur picture rikur  ·  4Comments

pranaybiswas2611 picture pranaybiswas2611  ·  3Comments

jrobber picture jrobber  ·  3Comments