< 리액트-네이티브(react-native) 새 프로젝트 생성 방법 (Expo를 사용하지 않는 방법) >



* 기본 충족사항 : npm 설치

 - 아래 관련 글 참조

[프로그래밍(Programming)/리액트 네이티브(React Native)] - 리액트 네이티브(react native) 설치~앱 구동 기초


* create-react-native-app 을 사용하는 방법

( 이 방법을 사용하면 초기 프로젝트에는 간편하지만, 추후 네이티브 라이브러리 사용과 배포용 빌드 생성 등을 위해서는 eject 가 필요함 ; npm run eject)

( expo-cli 를 이용한 방법과 같은 방식으로 새 프로젝트가 생성되며, 따라서 이 방법으로 만든 프로젝트는 expo start 로 바로 실행됨. )


npm install -g create-react-native-app

create-react-native-app testProject

cd testProject

npm start


* react-native-cli 를 사용하는 방법 (전형적인 방법)

( 이 방법으로 만든 프로젝트를 expo start로 실행하면 에러 발생함.)


npm install -g react-native-cli

react-native init testProject

cd testProject

react-native run-ios or react-native run-android


--> android 개발환경 세팅을 제대로 하지 않은 상태에서 react-native run-android 명령을 실행하면 아래와 같은 오류 메세지가 보임.


Starting JS server...

Building and installing the app on the device (cd android && gradlew.bat installDebug)...


ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.


Please set the JAVA_HOME variable in your environment to match the

location of your Java installation.

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


* expo-cli 를 사용하는 방법

 - 아래 관련 글 참조

[프로그래밍(Programming)/리액트 네이티브(React Native)] - Expo Xde 지원 중단에 따른 Expo dev tool(Expo cli) 설치 및 실행 방법



+ Recent posts