この文書の現在のバージョンと選択したバージョンの差分を表示します。
| 次のリビジョン | 前のリビジョン | ||
|
reactnative:expo:eject [2019/03/21 22:57] ips 作成 |
reactnative:expo:eject [2019/03/22 10:57] (現在) ips [React Native CLIコマンド] |
||
|---|---|---|---|
| ライン 1: | ライン 1: | ||
| ====== eject ====== | ====== eject ====== | ||
| + | |||
| + | [[https://medium.com/reactbrasil/being-free-from-expo-in-react-native-apps-310034a3729|Being free from “expo” in React Native apps]] | ||
| ====== eject ====== | ====== eject ====== | ||
| ライン 38: | ライン 40: | ||
| Ejected successfully! | Ejected successfully! | ||
| + | </code> | ||
| + | |||
| + | ===== npm g react-native-cli ===== | ||
| + | |||
| + | 通常のreact nativeコマンドを使えるようにする。 | ||
| + | |||
| + | <code> | ||
| + | >npm g react-native-cli | ||
| + | undefined | ||
| + | |||
| + | C:\Users\Ryu\react\expo-backgroundTimer>npm install -g react-native-cli | ||
| + | C:\Program Files (x86)\Nodist\bin\react-native -> C:\Program Files (x86)\Nodist\bin\node_modules\react-native-cli\index.js | ||
| + | + react-native-cli@2.0.1 | ||
| + | updated 3 packages in 1.3s | ||
| + | </code> | ||
| + | |||
| + | ===== React Native CLIコマンド ===== | ||
| + | |||
| + | <code> | ||
| + | npm install -g react-native-cli # cliをインストールしてから以下のコマンドを使用する | ||
| + | react-native init アプリ名 #新規アプリを作成 | ||
| + | react-native run-ios #iOSで起動します | ||
| + | react-native run-android #Androidで起動します | ||
| + | react-native link #ネイティブコードとのリンクを行う(パッケージをインストールするときによく使う) | ||
| </code> | </code> | ||
| ライン 62: | ライン 88: | ||
| at Module.load (internal/modules/cjs/loader.js:620:32) | at Module.load (internal/modules/cjs/loader.js:620:32) | ||
| </code> | </code> | ||
| - | |||
| - | ===== npm g react-native-cli ===== | ||
| - | |||
| - | <code> | ||
| - | >npm g react-native-cli | ||
| - | undefined | ||
| - | |||
| - | C:\Users\Ryu\react\expo-backgroundTimer>npm install -g react-native-cli | ||
| - | C:\Program Files (x86)\Nodist\bin\react-native -> C:\Program Files (x86)\Nodist\bin\node_modules\react-native-cli\index.js | ||
| - | + react-native-cli@2.0.1 | ||
| - | updated 3 packages in 1.3s | ||
| - | </code> | ||
| - | |||
| - | ===== react-native run-androidでエラー===== | ||
| <code> | <code> | ||
| ライン 100: | ライン 112: | ||
| </code> | </code> | ||
| を実行するとなおった。 | を実行するとなおった。 | ||
| + | |||
| + | ===== react-native run-androidのエラー ===== | ||
| + | |||
| + | [[https://qiita.com/n0bisuke/items/2c02f7a1be956440e72e|React NativeのAndroid実機ビルドと出たエラー対処メモ #rnjapan]] | ||
| + | |||
| + | <code> | ||
| + | >react-native run-android | ||
| + | Could not find the "expo" package in your project when configuring the packager | ||
| + | JS server already running. | ||
| + | Building and installing the app on the device (cd android && gradlew.bat installDebug)... | ||
| + | |||
| + | FAILURE: Build failed with an exception. | ||
| + | |||
| + | * What went wrong: | ||
| + | A problem occurred configuring project ':app'. | ||
| + | > SDK location not found. Define location with sdk.dir in the local.properties file or with an ANDROID_HOME environment variable. | ||
| + | |||
| + | * Try: | ||
| + | Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. | ||
| + | |||
| + | * Get more help at https://help.gradle.org | ||
| + | |||
| + | BUILD FAILED in 1s | ||
| + | Could not install the app on the device, read the error above for details. | ||
| + | Make sure you have an Android emulator running or a device connected and have | ||
| + | set up your Android development environment: | ||
| + | https://facebook.github.io/react-native/docs/getting-started.html | ||
| + | </code> | ||
| + | |||
| + | 環境変数に<html>ANDROID_HOME</html>に<html>C:\Users\ユーザー名\AppData\Local\Android\sdk</html>を追加する。 | ||
| + | |||
| + | 環境変数変更後はプロンプトやvscodeの再起動が必要。 | ||
| + | |||
| + | ===== Could not find tools.jar. Please check that C:\Program Files\Java\jre1.8.0_201 contains a valid JDK installation ===== | ||
| + | |||
| + | システム環境変数に<html>JAVA_HOME</html>に<html>C:\Program Files\Java\jre1.8.0_201</html>を追加する。 | ||
| + | |||
| + | <code> | ||
| + | 下記コマンドで設定を確認 | ||
| + | >echo %JAVA_HOME% | ||
| + | C:\Program Files\Java\jre1.8.0_201 | ||
| + | </code> | ||