2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

Nuxt localhostで立ち上げたアプリをiPhoneで起動させる方法

Last updated at Posted at 2021-06-23

Nuxtのローカルホストで立ち上げたアプリをiPhoneで起動させる

Nuxtのローカルホストで立ち上げたアプリをモバイル端末で開こうとしたら少し詰まったのでメモ

環境

macOS BigSur 11.01
iPhone Xr iso14.2

Nuxt側の設定

nuxt.config.jsファイルに以下を追記

nuxt.config.js

  server: {
    host: '0.0.0.0', // デフォルト: localhost,
    timing: false,
  },

Macの設定

設定からファイアウォールをオフにする(セキュリティ的観点で見てテストが終わったらオンにしましょう)
スクリーンショット 2021-06-24 5.10.44.png

 iPhoneでアプリを起動

npm run dev or yarn dev した際に表示される以下のものをコピ
私の環境ではhttp://192.168.101.25:3000/コピーするか手入力してsafariで開く
スクリーンショット 2021-06-24 5.16.42.png
すると以下のように開くことができる
IMG_4400.jpg

2
1
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
2
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?