Reactで作ったアプリをFirebaseでdeployしようとしたら、、、
✔ functions: Finished running predeploy script.
i functions: ensuring required API cloudfunctions.googleapis.com is enabled...
i functions: ensuring required API cloudbuild.googleapis.com is enabled...
⚠ functions: missing required API cloudbuild.googleapis.com. Enabling now...
✔ functions: required API cloudfunctions.googleapis.com is enabled
Error: HTTP Error: 400, Billing account for project 'プロジェクト番号' is not found. Billing must be enabled for activation of service(s) 'cloudbuild.googleapis.com,containerregistry.googleapis.com' to proceed.
このようなdeployエラーに遭遇しました。今回はこのエラーの原因と解決方法を備忘録として残します。
解決方法
functionsにあるpackage.jsonファイルのnodeを10から8に変えます。
"engines": {
"node": "10"
},
こちらを以下のように変更する。
"engines": {
"node": "8"
},
原因
node 10を使用するには、クラウド機能の課金アカウントが必要です。おそらく、グーグルが無料のサービスを提供するのではなく、請求可能なアカウントに人々を移動させるためにこのような仕様にしているのだと思います。そのため、解決するにはpackage.jsonのnode 8に変更する必要があります。
何か間違いやご指摘があれば、よろしくお願い致します。