LoginSignup
18
17

More than 5 years have passed since last update.

macでfirebaseを利用できる環境構築からデプロイまでの備忘録

Last updated at Posted at 2018-05-04

ローカルでの環境を構築する

とりあえず動かすとこまでのメモ

node.jsをインストールする

ターミナルを起動して以下のコマンドを実行

node -v

インストールされていない(バージョンが表示されない)場合は、homebrewをインストールする。
インストール用のコマンドは公式サイトに乗っているので確認する。
2018/4/21時点では以下のコマンドを実行した。

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

nodebrewをインストールする。

brew install nodebrew

node.jsをインストールする

nodebrew install-binary latest

使用するバージョンを有効化する

nodebrew use latest

実行パスを通す

echo 'export PATH=$PATH:/Users/[ユーザー名]/.nodebrew/current/bin' >> ~/.bashrc

*[ユーザー名]の部分は書き換えが必要

ターミナルを再起動して、以下のコマンドを実行する。
実行パスの設定が読み込まれていないので、再起動して読み込ませる必要がある。

node -v
npm -v

両方ともバージョンが表示されればインストール完了。
もしバージョンが表示さればい場合は書き換えた実行パスが正しいか確認する。

firebaseを利用できるようにする

firebaseから、新規プロジェクトを作成する。

ターミナルから以下のコマンドを実行する。

npm install -g firebase-tools
firebase login

googleにログインする
ログインできたら、ターミナルから以下のコマンドを実行する

firebase init

何を選択するか聞かれるので、とりあえず以下を選択
Hosting: Configure and deploy Firebase Hosting

あとは適当に全部enter

以下のコマンドを実行

firebase serve

でローカルでページが開けるようになる。

公開する

デプロイするときは以下のコマンドを実行

firebase deploy

以下のコマンドで、ページを開く

firebase open hosting:site
18
17
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
18
17