sanx26
@sanx26

Are you sure you want to delete the question?

If your question is resolved, you may close it.

Leaving a resolved question undeleted may help others!

We hope you find it useful!

firebaseでのhostingについて

解決したいこと

Node.js v14.18.0
Visual Studio Code

先日LINEでアプリを作ろうと思い、LIFFを初めて触りました。
その際にfirebaseを用いてhostingを行うと学んだので、以下の手順で実行してみました。
初投稿なので、不備があるかもしれません。
お手数をおかけしますが、解決方法がわかる方がいらっしゃいましたら教えていただけますと幸いです。

実行手順

install

npm install -g firebase-tools

Login

firebase login

ここで止まってしまいました。

firebase init

Before we get started, keep in mind:

  * You are initializing within an existing Firebase project directory

? Are you ready to proceed? Yes
? Which Firebase features do you want to set up for this directory? Press Space to select features, then Enter to confirm your choices. (Press <space> to select, <a> to toggle all, <i> to invert selection, and <enter> to proceed)

 ( ) Realtime Database: Configure a security rules file for Realtime Database and (optionally) provision default instance
 ( ) Firestore: Configure security rules and indexes files for Firestore
 ( ) Functions: Configure a Cloud Functions directory and its files
>(*) Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
 (*) Hosting: Set up GitHub Action deploys
 ( ) Storage: Configure a security rules file for Cloud Storage
 ( ) Emulators: Set up local emulators for Firebase products
(Move up and down to reveal more choices)

私が参考にさせて頂きました、投稿主様は上記「*」の箇所に以下の文章が表示されておりました。

>(*) Hosting: Configure and deploy Firebase Hosting sites

自分で試したこと

Node.jsのバージョンをv11.13.0に変更してみましたが、そうすると以下の文章が表示されました。

Firebase CLI v11.2.1 is incompatible with Node.js v11.13.0 Please upgrade Node.js to version ^14.18.0 || >=16.4.0

対応していないバージョンにしていたので、対応しているものに変更しましたが、投稿主様と同じ結果になりませんでした。
これを進めていくと、ファイル内に「404.html」「index.html」が作成されると記載されていたのですが、上記の問題により止まってしまっている状態です。
初歩的なことかもしれませんので、個人で調べながら進めていきたいと思います。

参考資料

「firebaseでhostingするまでの備忘録」, @yasupeke様 https://qiita.com/yasupeke/items/c27abd951e216bf48f4f
「【初級】LINE の中で動くアプリケーションを作る! LIFF」, coding-friday様 https://www.youtube.com/watch?v=vYpOtdHJ8cU&ab_channel=coding-friday
0

4Answer

windowsなら「where node」なのかも

そしてもしかしたら

  1. nodeはv14.18.0
  2. firebase initでBefore we get started, keep in mind: ...等の表示はある
  3. 下キーを押すと>が下って行き、> ( ) Hosting: Configure and deploy Firebase Hosting sitesに移動はできるが、
  4. ( * )という表示にはならない

という事ですか????

もしそうならコンソールでのこういう選択は基本スペースキーですよ。

> ( ) Hosting: Configure and deploy Firebase Hosting sites

まで移動してスペースキー押したら

> (*) Hosting: Configure and deploy Firebase Hosting sites

となりませんか?

1Like

Comments

  1. @sanx26

    Questioner

    ご回答ありがとうございます。
    ご指摘について番号順に答えさせて頂きます。
    1.nodeはv14.18.0
     →その通りでございます。

    2.firebase initでBefore we get started, keep in mind: ...等の表示はある
     →表示はあります。

    3.下キーを押すと>が下って行き、> ( ) Hosting: Configure and deploy Firebase
    Hosting sitesに移動はできるが
     →下キーで下がっていき、スペースキーで選択はできます。
      が、上記の「Hosting: Configure and deploy Firebase Hosting sites」
      が表示されない状態です。

    実行手順に記載のある通り、選択できるものとして
    ( ) Realtime Database: Configure a security rules file for Realtime Database and (optionally) provision default instance
    ( ) Firestore: Configure security rules and indexes files for Firestore
    ( ) Functions: Configure a Cloud Functions directory and its files
    >(*) Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys
    (*) Hosting: Set up GitHub Action deploys
    ( ) Storage: Configure a security rules file for Cloud Storage
    ( ) Emulators: Set up local emulators for Firebase products

    のみでございます。

    また、「where node」を実行した所、C:\Program Files (x86)\Nodist\bin\node.exeと表示されました。インストールした際に記憶が正しければ、この箇所を指定した気がしますので、問題はないと自負しております。

    お忙しいところ、ご回答いただきまして、誠にありがとうございます。
  2. 全く同じ選択肢が見当たらないよって事ですね。
    参照しているものが既に1年以上経過しているので、通常は情報が古いと考えます。
    なので同じ選択肢も既に変わっていると考えたほうが良いかも知れません。

    web系は進化がとても早いので1年以上前の情報はあまり真剣に参考しないほうが良いかも知れません。
    全くわからない状態から始めているのであれば、まずはここ1年以内の参考記事を探してみてはどうですか?
  3. @sanx26

    Questioner

    ご回答ありがとうございます。
    web系は進化がとても速いのは把握しておりましたが、ここまで早いとは思ってもいませんでした。良い勉強となりました。
    お教えいただきました通り、最近の参考記事等を調べ、再度挑戦しようと思います。
    ここまで、ありがとうございました。

Comments

  1. @sanx26

    Questioner

    ご回答ありがとうございます。
    翻訳は既にしており、バージョンがあっていないのは理解していますので、質問以降はバージョンを指示通りにして試行錯誤しております。
    質問するにあたり、説明が足りなく誠に申し訳ございません。一部修正させていただきます。

対応しているものに変更しましたが、投稿主様と同じ結果になりませんでした。
これを進めていくと、ファイル内に「404.html」「index.html」が作成されると記載されていたのですが、上記の問題により止まってしまっている状態です。

上記の問題とはこれのことですよね?

Firebase CLI v11.2.1 is incompatible with Node.js v11.13.0 Please upgrade Node.js to version ^14.18.0 || >=16.4.0

という事はやはりnodeのバージョンが古いまま(v11.13.0)なのでは?

$ which node
$ node -v

ってやったとして何が返ってきますか? nodeがインストールされている先は思っている場所ですか?

0Like

Comments

  1. @sanx26

    Questioner

    ご回答ありがとうございます。
    度重なる説明不足の所、誠に申し訳ございませんが、上記の問題とは、
    「firebase init」入力後に投稿様と同じ
    「>(*) Hosting: Configure and deploy Firebase Hosting sites」が表示されない所でございます。
    昨日、ご指摘いただきました通り、nodeのバージョンを
    「v14.18.0」に変更し、実行しましたが結果は変わりませんでした。

    また、「whisch node」と入力すると、
    「'which'は内部コマンドまたは外部コマンド
     操作可能なプログラムまたはバッチファイルとして認識されません」

    「node -v」と入力すると、
    「v14.18.0」と表示されます。

    ご回答誠にありがとうございます。

具体的な問題点はなんでしょうか?

firebaseのCLIはバージョンによってよく表記が変わるので、

(*) Hosting: Configure and deploy Firebase Hosting sites

こちらは何年か前の古いFirebaseでの表示であり、

(*) Hosting: Configure files for Firebase Hosting and (optionally) set up GitHub Action deploys

現在はこちらの表記に代わっているので、
両者は同じものと思われます。

0Like

Your answer might help someone💌