TroubleShooting/ios

[ReactNative] Build Error : Command PhaseScriptExecution failed with a nonzero exit code

나인에스 2022. 2. 16. 16:04
Error: Could not find node. Make sure it is in bash PATH or set the NODE_BINARY environment variable.
Command PhaseScriptExecution failed with a nonzero exit code

바쁘신 분들은 아래 3번 항목의 해결 방법만 보시면 됩니다.

1. 증상

Build Error 발생 화면

위의 그림과 같이 React Native설치/설정하고 최초 빌드시 발생할 수 있는 build error 이다

2. 원인

내용을 보면 

$> /bin/sh -c /Users/pokers/Library/Developer/Xcode/DerivedData/petProject-fqxqdrnzsexhqfenqxiavodrtzzj/Build/Intermediates.noindex/Pods.build/Debug-iphoneos/FBReactNativeSpec.build/Script-7BCEB2A3CB45155489DB81408A99505A.sh

위의 명령어를 이용해서 script 파일을 실행 했고, 이때 실행된 스크립트 파일에서 node 를 사용하고 있는데 node를 PATH에서 찾지 못해서 아래와 같은 error가 발생하고 fail 종료되었다는 메세지 발생.

Error: Could not find node. Make sure it is in bash PATH or set the NODE_BINARY environment variable.

3. 해결 방법

Terminal에서 아래의 명령어를 실행 해서 node의 soft link를 생성해주면됩니다.

$>sudo ln -s $(which node) /usr/local/bin/node