LoginSignup
40
19

More than 5 years have passed since last update.

React Native エラー Can’t find ‘node’ binary to build React Native bundle

Last updated at Posted at 2016-07-25

React Nativeで実機ビルドしたエラーが出だした

そしたら

Can't find 'node' binary to build React Native bundle

というエラーが出た。

こちらの記事のおかげでnodeのパス直せばいいことがわかった。自分の場合はパスが違ったため、どのようにしたかを書いていきます。

パスの調べ方

普段使わないPCでいろいろやっては失敗して今に至るためnode本体がどこにあるかわからなかった。そこで、

export -p

とbashで実行させていろんなパスを出させてみた。
すると自分の場合はこんな環境変数が出てきた。

declare -x PATH="/Users/YutamaKotaro/.nodebrew/current/bin:
/Users/YutamaKotaro/.nodebrew/current/bin:
/Users/YutamaKotaro/.nodebrew/current/bin:
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin"

どうやらnodebrewを使っているらしい。

後は先ほどの記事に従って
Project ファイル > TARGETS > APP Name > Build Phases > Bundel React Native code and image
を開いて

export NODE_BINARY=node
../node_modules/react-native/packager/react-native-xcode.sh

となっているところを

export NODE_BINARY=$HOME/.nodebrew/current/bin/node
../node_modules/react-native/packager/react-native-xcode.sh

と直した!

これでうまくいきました!!
ご不明点、誤りなどありましたらご指摘頂けますと幸いです。

40
19
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
40
19