LoginSignup
0
0

More than 5 years have passed since last update.

ReactNative のインストールとサンプル実行

Posted at

React Native に興味があるので、触ってみようと思います。


取り急ぎ、公式の Getting Started の通りに実行してみます。

インストール

$ sudo npm install -g create-react-native-app

新規プロジェクト作成

create-react-native-app コマンドでプロジェクト作成

$ mkdir ReactNative

$ create-react-native-app AwesomeProject

$ cd AwesomeProject

$ ls -1
App.js
App.test.js
README.md
app.json
node_modules
npm-debug.log
package.json

プロジェクト実行(?)(失敗)

$ npm start

何やらエラーが出ました。とりあえず https://git.io/v5vcn を見てみます。

20:49:59: Unable to start server
See https://git.io/v5vcn for more information, either install watchman or run the following snippet:
  sudo sysctl -w kern.maxfiles=5242880
  sudo sysctl -w kern.maxfilesperproc=524288

Environment のリストを確認したところ、yarn と watchman がインストールされていないようです。

$ yarn --version
-bash: yarn: command not found
$ watchman version
-bash: watchman: command not found

yarn インストール

$ brew install yarn

今度は何?

...

/usr/local/Homebrew/Library/Homebrew/brew.rb:12:in `<main>': Homebrew must be run under Ruby 2.3! You're running 2.0.0. (RuntimeError)

Ruby 2.3 が必要? rbenv で 2.4.3 を入れて再度実行します。

$ ruby -v
ruby 2.4.3p205 (2017-12-14 revision 61247) [x86_64-darwin16]

$ brew install yarn

$ yarn --version
1.3.2

OK

watchman インストール

$ brew install watchman

$ watchman version
{
    "version": "4.9.0"
}

OK

プロジェクト再実行

$ npm start

スクリーンショット 2017-12-17 21.54.35.png

なるほど。これでサーバが動作してるのかな。

expo のインストール

iPhone に expo アプリ をインストール。


IMG_4635.PNG

expo で QR 読み込み


IMG_4636.PNG

あれ?同じネットワークなのだけど、繋がらない? 後で別なネットワークでもう一度試して見ます。一旦終了。

まだよく分からない。もう少しドキュメントも読んでますか。


0
0
0

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
0
0