Frontend ๊ฐœ๋ฐœ์ž - hyo.loui

๋ฆฌ์•กํŠธ ๋„ค์ดํ‹ฐ๋ธŒ - ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ๋งŒ๋“ค๊ธฐ (expo), ์—๋Ÿฌ ํ•ด๊ฒฐ ๋ณธ๋ฌธ

React-Navtive

๋ฆฌ์•กํŠธ ๋„ค์ดํ‹ฐ๋ธŒ - ์ƒˆ๋กœ์šด ํ”„๋กœ์ ํŠธ ๋งŒ๋“ค๊ธฐ (expo), ์—๋Ÿฌ ํ•ด๊ฒฐ

hyo.loui 2022. 12. 30. 02:18

๐ŸŽฏ๋ชฉ์  :

๋ฆฌ์•กํŠธ ๋„ค์ดํ‹ฐ๋ธŒ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•˜๊ณ 

expo ํŒจํ‚ค์ง€๋ฅผ ํ™œ์šฉํ•˜์—ฌ ์‰ฌ์šด ์…‹์—… ๋ฐ ๋น ๋ฅธ ์ดˆ๊ธฐ๊ฐœ๋ฐœ์„ ํ•ด๋ณด์ž!

 

๐Ÿคข ์˜ค๋ฅ˜ ํ•ด๊ฒฐ :

  • expo request time out
  • CommandError: ngrok tunnel took too long to connect.

 


1. expo ๊ณ„์ •์—์„œ project ์ƒ์„ฑ

.

https://expo.dev/

 

Expo

Expo is an open-source platform for making universal native apps for Android, iOS, and the web with JavaScript and React.

expo.dev

์œ„ ์‚ฌ์ดํŠธ์—์„œ ๊ณ„์ •์„ ๋งŒ๋“ค์–ด์•ผ ํ•œ๋‹ค 

 

 

๊ณ„์ •์„ ์ƒ์„ฑํ–ˆ๋‹ค๋ฉด, Create a project ์—์„œ
ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ•˜๋ฉด ์•„๋ž˜๋กœ ๋„˜์–ด๊ฐ„๋‹ค

๋‚˜๋Š” test ๋ผ๋Š” ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ–ˆ๋‹ค

๊ทธ๋Ÿผ ์œ„์ฒ˜๋Ÿผ ์นœ์ ˆํ•˜๊ฒŒ ํ”„๋กœ์ ํŠธ๋ฅผ ์—ฐ๊ฒฐํ•˜๋Š” ๋ช…๋ น์–ด๋ฅผ ์•Œ๋ ค์ค€๋‹ค!

์ด์ œ ๋ช…๋ น์–ด ๋Œ€ํ•ด ๊ฐ„๋‹จํžˆ ํ•ด์„ํ•˜๊ณ  ๋”ฐ๋ผํ•ด๋ณด์ž

 

 


2-1. ์ „์—ญ์— expo ํŒจํ‚ค์ง€ ์„ค์น˜ ( ์ „์— ์„ค์น˜ํ–ˆ๋‹ค๋ฉด ์ƒ๋žต )

 

npm install -g eas-cli

์œ„ ๊ณผ์ •์€ ๋‚ด ์ปดํ“จํ„ฐ, ์œˆ๋„์šฐ์— eas ํ”„๋กœ๊ทธ๋žจ์„ ์„ค์น˜ํ•˜๋Š” ๊ณผ์ •์ด๋ผ๊ณ  ์ƒ๊ฐํ•˜์ž

 


2-2. Propject ์ƒ์„ฑ

 

์—ฌ๊ธฐ์„œ ์ฃผ์˜ํ•  ์ ์€ ํ„ฐ๋ฏธ๋„์—์„œ ํ”„๋กœ์ ํŠธ๋ฅผ ์ƒ์„ฑํ• 
๊ฒฝ๋กœ๋ฅผ ๋‹ค์‹œ ํ•œ๋ฒˆ ํ™•์ธ ํ›„ ์ง„ํ–‰ํ•˜๊ธธ ๋ฐ”๋ž€๋‹ค

 

npx create-expo-app 'ํ”„๋กœ์ ํŠธ ์ด๋ฆ„'

์ด ๊ณผ์ •์€ ์šฐ๋ฆฌ๊ฐ€ ๋ฆฌ์•กํŠธ ํ”„๋กœ์ ํŠธ๋ฅผ ๋งŒ๋“ค๋•Œ

์‚ฌ์šฉํ•œ create react-app์œผ๋กœ ์ƒ์„ฑํ•˜๋Š” ๊ณผ์ •๊ณผ ์•„์ฃผ ์œ ์‚ฌํ•˜๋‹ค

 


2-3. eas init

 

์œ„์—์„œ ๋งŒ๋“  ํ”„๋กœ์ ํŠธ๋ฅผ eas ์›๊ฒฉ์— ์—ฐ๊ฒฐํ•˜๋Š” ๊ณผ์ •์ด๋‹ค!

eas init --id 'ํ”„๋กœ์ ํŠธ id'

 

+ ์ด ๊ณผ์ •์—์„œ ์ฒ˜์Œ eas ๋ช…๋ น์–ด๋ฅผ ์‚ฌ์šฉํ–ˆ๋‹ค๋ฉด,

๋ช…๋ น ์ฐฝ์—์„œ๋Š” ๊ณ„์ •์„ ์—ฐ๊ฒฐํ•  ์ˆ˜ ์žˆ๋„๋ก ๋„์™€์ค„ ๊ฒƒ์ด๋‹ค.

 

์œ„์— 1๋ฒˆ์—์„œ ์ง„ํ–‰ํ–ˆ์„ ๋•Œ ์ƒ์„ฑํ•œ ๊ณ„์ •์„ ์—ฐ๊ฒฐํ•ด์•ผ ํ•œ๋‹ค!

์šฐ๋ฆฌ๊ฐ€ ๊นƒํ—ˆ๋ธŒ๋ฅผ ์ฒ˜์Œ์— ์—ฐ๋™ํ–ˆ์„ ๋•Œ์™€ ์œ ์‚ฌํ•œ ๊ณผ์ •์ด๋‹ค 

 

์ •์ƒ์ ์œผ๋กœ init์ด ๋˜์—ˆ๋‹ค๋ฉด ์šฐ๋ฆฌ๊ฐ€ ํ”„๋กœ์ ํŠธ๋ฅผ ์ •์ƒ์ ์œผ๋กœ ์„ค์น˜ํ•˜๊ณ  ์—ฐ๊ฒฐ๊นŒ์ง€ ๋๋ƒˆ๋‹ค

์ด์ œ ๊ตฌ๋™์ด ์ •์ƒ์ ์œผ๋กœ ๋˜๋Š”์ง€ ํ…Œ์ŠคํŠธ ํ•ด ๋ณด์ž

 


3. ํ”„๋กœ์ ํŠธ ๊ตฌ๋™

 

npm start

์—ฌ๊ธฐ์„œ๋Š” ์šฐ๋ฆฌ๊ฐ€ ๋‹ค๋ฅธ ํ”„๋กœ์ ํŠธ๋ฅผ ๊ตฌ๋™ํ•œ ๊ฒƒ๊ณผ ๋™์ผํ•˜๋‹ค.

ํ•˜์ง€๋งŒ ๋‚˜๋Š” ์—ฌ๊ธฐ์„œ ์˜ค๋ฅ˜๊ฐ€ ๋ฐœ์ƒํ–ˆ๋‹ค.

์˜ค๋ฅ˜๋Š” ๋ฐ‘์—์„œ ์ƒ์„ธํ•˜๊ฒŒ ์„ค๋ช…ํ•˜๊ฒ ๋‹ค.

 

์ด๋ ‡๊ฒŒ ๊ตฌ๋™์ด ๋œ๋‹ค๋ฉด

์šฐ๋ฆฌ๊ฐ€ ๋งŒ๋“  RNํ”„๋กœ์ ํŠธ๊ฐ€ ์ •์ƒ ์ž‘๋™์ด ๋œ ๊ฒƒ์ด๋‹ค!.

 


4. ๋‚ด ์Šค๋งˆํŠธํฐ์—์„œ ์‹ค์‹œ๊ฐ„ ๊ตฌ๋™ํ•˜๊ธฐ

 

์•„์ฃผ ๊ฐ„๋‹จํ•˜๋‹ค ๋ณต์žกํ•œ ๊ฒƒ ์—†๋‹ค

๋ณธ์ธ์˜ ๋””๋ฐ”์ด์Šค ์Šคํ† ์–ด์—์„œ expo ์•ฑ์„ ์„ค์น˜ํ•˜๋ฉด ๋œ๋‹ค

IOS ์•ฑ์Šคํ† ์–ด

์ดํ›„์—๋Š” ์นด๋ฉ”๋ผ, QR ๋ฆฌ๋”๋ฅผ ํ†ตํ•ด

์œ„์— npm start ํ›„ ๋ช…๋ น์ฐฝ์— ์ƒ์„ฑ๋œ QR ์ฝ”๋“œ๋ฅผ ์ธ์‹ํ•˜๋ฉด ๋œ๋‹ค!

 

.

 


+ expo request time out ์˜ค๋ฅ˜ ํ•ด๊ฒฐ

 

๊ฒ€์ƒ‰ ๊ฒฐ๊ณผ window์—์„œ ํ”ํžˆ ๋ฐœ์ƒํ•˜๋Š” ์—๋Ÿฌ์˜€๋‹ค..

๋„คํŠธ์›Œํฌ ๋ฐฉํ™”๋ฒฝ ๋ฌธ์ œ๋กœ

  • ํ•ด๋‹น ์ฃผ์†Œ๋ฅผ ์—ด์–ด์ฃผ๊ฑฐ๋‚˜
  • ์šฐํšŒ๋ฅผ ํ•ด์•ผ ํ•œ๋‹ค๊ณ  ํ•œ๋‹ค.

๋‚˜๋Š” ๊ฐ„๋‹จํ•˜๊ฒŒ ์šฐํšŒํ•˜๋Š” ๋ฐฉ๋ฒ•์„ ํ†ตํ•ด์„œ ํ•ด๊ฒฐํ–ˆ๋‹ค

์ •๋ง ๊ฐ„๋‹จํ•˜๋‹ค.

 

package.json ํŒŒ์ผ์—์„œ start ๊ตฌ๋ฌธ์— --tunnel ์„ ์ถ”๊ฐ€ํ•˜๋ฉด ๋œ๋‹ค

before - ํ•ด๊ฒฐ ์ „
after - ํ•ด๊ฒฐ ํ›„

 

์ดํ›„์— npm start ๋ช…๋ น์„ ์ž…๋ ฅํ•˜๋‹ˆ ์ •์ƒ ์ž‘๋™ ๋˜์—ˆ๋‹ค

 

์œ„์ฒ˜๋Ÿผ ์ž‘๋™์ด ๋˜๋ฉด ์ •์ƒ ์ž‘๋™์ด ๋˜๋Š” ๊ฒƒ์ด๋‹ค!

 

 

 

์•„๋ž˜ ๋ธ”๋กœ๊ทธ๋ฅผ ํ†ตํ•ด ๋ฌธ์ œ๋ฅผ ํ•ด๊ฒฐํ–ˆ๋‹ค.

https://ohrora-developer.tistory.com/11

 

expo request time out ์ด ๋ฐœ์ƒํ•˜๋Š” ๊ฒฝ์šฐ

๊ฐ€๋”์‹ request time out์ด ๋ฐœ์ƒํ•ด์„œ ํ”„๋กœ์ ํŠธ์˜ ๊ฒฐ๊ณผ ๊ฐ’์„ ํ™•์ธํ•˜์ง€ ๋ชปํ•  ๋•Œ๊ฐ€ ๋งŽ๋‹ค. expo request time out ๋‚˜๋Š” ๊ฒฝ์šฐ๋Š” ์–ด๋–ป๊ฒŒ ํ•ด๊ฒฐํ•ด์•ผํ• ๊นŒ? 1. ๋„คํŠธ์›Œํฌ ํ™•์ธํ•˜๊ธฐ ์šฐ์„  ์ œ์ผ ๋จผ์ € ํ™•์ธํ•ด์ค˜์•ผ ํ•˜๋Š” ๊ฒƒ์€

ohrora-developer.tistory.com

 


+ CommandError: ngrok tunnel took too long to connect. ์˜ค๋ฅ˜ ํ•ด๊ฒฐ

 

์ดํ›„์— ๊ฐ„ํ˜น ์ด๋Ÿฌํ•œ tunnel ์—๋Ÿฌ๊ฐ€ ๋ฐœ์ƒํ–ˆ๋Š”๋ฐ.

 

CommandError: ngrok tunnel took too long to connect.

์ด ๊ณผ์ •์€ tunnel ์‹œ๊ฐ„์ด ์˜ค๋ž˜๊ฑธ๋ ธ๋‹ค๋Š” ๋œป์ด๋‹ค

 

ํ„ฐ๋ฏธ๋„ ๋ฉ”์„ธ์ง€

 

๋‹ค์‹œ ์‹œ๋„ํ•˜๋ฉด ๋œ๋‹ค.

 

์‚ฌ์‹ค.. ํ•œ 5๋ฒˆ๊นŒ์ง€ ํ–ˆ๋˜ ์ ๋„ ์žˆ๋‹ค.


 

 ์ตœ์ข… ์ •๋ฆฌ 

  1. expo์—์„œ ํ”„๋กœ์ ํŠธ ์ƒ์„ฑ
  2. expo ํŒจํ‚ค์ง€ ์„ค์น˜(์ด๋ฏธ ์„ค์น˜ ๋˜์–ด์žˆ์œผ๋ฉด ์ƒ๋žต)
  3. ํ„ฐ๋ฏธ๋„์—์„œ Propject ์ƒ์„ฑ [ npx create-expo-app projectname ]
  4. eas init [ eas init id 'project id ]
  5. npm start - ์ด ๊ณผ์ •์—์„œ QR ์ž๋™ ์ƒ์„ฑ ๋จ
  6. ์Šค๋งˆํŠธํฐ์— 'Expo Go' ์„ค์น˜ ํ›„ QR ์ธ์‹