1. 程式人生 > >編譯依賴於React Native0.46.4的工程,報錯“react-native-xcode.sh now lives in a different location”

編譯依賴於React Native0.46.4的工程,報錯“react-native-xcode.sh now lives in a different location”

webstorm alt where git span command com pen app

我的環境:

WebStorm 2017.2
Build #WS-172.3317.70, built on July 14, 2017

JRE: 1.8.0_152-release-915-b5 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o

Mac OS X 10.12.6

Xcode8.3.3(8E3004b)

RN在Github上有比較明確的解決方案,但是對於Xcod不是十分熟悉,沒有一步一步明確的指導,最終在stackoverflow上找到可以解決我的問題的帖子。

選自:https://stackoverflow.com/questions/33650380/react-native-error-react-native-xcode-sh-line-45-react-native-command-not-found

If you are using RN 0.46 or above:

There is a breaking change made by Facebook: the location of the script has been changed, more detail here

I was able to solve this error by:

  • Opening the project in XCode
  • Navigate to Build Phases > Bundle React Native code and images
  • Change export NODE_BINARY=node ../node_modules/react-native/packager/react-native-xcode.sh
    to export NODE_BINARY=node ../node_modules/react-native/scripts/react-native-xcode.sh

Notice how packager is now scripts, which is where that file actually lives in latest version of RN

技術分享

編譯依賴於React Native0.46.4的工程,報錯“react-native-xcode.sh now lives in a different location”