ExpoとFlutter選択
ちょっとしたアプリを作るのに、どちらが良いのか迷っている。
ExpoはWindows環境でもiOS実機で動作確認ができるのが魅力。
ただ、「ちょっとした」アプリでそこまでする必要があるのかというと微妙。
やっぱりFlutterの習熟度を上げていくのが良いのかなぁ。
POSTS
ちょっとしたアプリを作るのに、どちらが良いのか迷っている。
ExpoはWindows環境でもiOS実機で動作確認ができるのが魅力。
ただ、「ちょっとした」アプリでそこまでする必要があるのかというと微妙。
やっぱりFlutterの習熟度を上げていくのが良いのかなぁ。
WSL2 の localhostForwarding 機能がうまくうごかない - mrk21::blog {}
この記事を見ながらやってみたけど、うまくいかない。 もしかしたら経路のどこかでブロックされているのかもしれない。
うまくいったとしても、QRコードがWSL2のIPで作られているので、手打ちでWindows11のIPを打たないといけないのは面倒。
以前一度使ってみたことがあるExpoに再入門。
前にやったときはWSLだとダメでラズパイで動かしていたけど、もう1年以上たっているしいけるのでは?という期待を込めてWSL2でやってみる。
$ sudo npm install --global expo-cli
$ cd photomap
$ expo init .
✔ Choose a template: › tabs (TypeScript) several example screens and tabs using react-navigation and TypeScript
✔ Downloaded template.
📦 Using npm to install packages.
✔ Installed JavaScript dependencies.
✅ Your project is ready!
To run your project, run one of the following npm commands.
- npm start # you can open iOS, Android, or web from here, or run them directly with the commands below.
- npm run android
- npm run ios # requires an iOS device or macOS for access to an iOS simulator
- npm run web
Project is already inside of a git repo, skipping git init.
$ npm start
> photomap@1.0.0 start
> expo start
Starting project at /home/umemak/workspace/photomap
Starting Metro Bundler
› Metro waiting on exp://127.0.0.1:19000
› Scan the QR code above with Expo Go (Android) or the Camera app (iOS)
› Press a │ open Android
› Press w │ open web
› Press r │ reload app
› Press m │ toggle menu
› Press ? │ show all commands
Logs for your project will appear below. Press Ctrl+C to exit.
✔ It looks like you're trying to use web support but don't have the required dependencies installed. Would you like to install
webpack-dev-server@~3.11.0, @expo/webpack-config@~0.16.2? … yes
✔ Installed webpack-dev-server@~3.11.0, @expo/webpack-config@~0.16.2
CommandError: Missing package "webpack-dev-server" in the project. Try running the command again. (cwd: /home/umemak/workspace/photomap)
Expo GoでQRスキャンしても、LAN内のIPアドレス指定してマニュアル接続してみても接続できなかった。
Read moreWSLでいろいろ試してみたものの、ポート関連のエラーで動かないので、Raspberry piで試してみた。
rbenv
を使ってみる。libssl-dev
とlibreadline-dev
を入れる。$ sudo apt-get install -y libssl-dev libreadline-dev
$ git clone https://github.com/rbenv/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ rbenv rehash
$ rbenv install --list
$ rbenv install 2.6.6
$ rbenv global 2.6.6
$ rbenv rehash
$ ruby --version
ruby 2.6.6p146 (2020-03-31 revision 67876) [aarch64-linux]
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
$ sudo apt-get install build-essential
$ echo 'eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)' >> /home/pi/.profile
$ eval $(/home/linuxbrew/.linuxbrew/bin/brew shellenv)
$ brew --version
Homebrew 2.4.8
Homebrew/linuxbrew-core (git revision 39fddf7; last commit 2020-07-21)
$ brew install nodebrew
$ mkdir -p ~/.nodebrew/src
$ nodebrew install stable
$ nodebrew ls
$ nodebrew use v14.6.0
$ vi ~/.profile
export PATH=$HOME/.nodebrew/current/bin:$PATH
$ source ~/.profile
$ node -v
v14.6.0
expo-cli
をインストールしないで、init後にaddしている。tabs (TypeScript)
を選択した。$ cd workspace/
$ npx expo-cli init expotest
$ cd expotest/
$ npm install --save-dev expo-cli
npm start
後、しばらくすると以下のエラーが出るので、上限を上げる。Error: ENOSPC: System limit for number of file watchers reached, watch '/home/pi/workspace/expotest/node_modules/metro/node_modules/string-width/node_modules/ansi-regex'
$ cat /proc/sys/fs/inotify/max_user_watches
8192
$ sudo su
# echo fs.inotify.max_user_watches= 65536 | tee -a /etc/sysctl.conf
fs.inotify.max_user_watches= 65536
# cat /proc/sys/fs/inotify/max_user_watches
8192
# sysctl -p
fs.inotify.max_user_watches = 65536
# cat /proc/sys/fs/inotify/max_user_watches
65536
# exit
$ npm start