fireabase開発でfunctions deploy時以下のエラーが
firebase学習中、初歩のfunctionsの利用をしてみようと以下のコードをdeployしたくdeployを実行。
index.js
1const functions = require("firebase-functions"); 2 3// // Create and Deploy Your First Cloud Functions 4// // https://firebase.google.com/docs/functions/write-firebase-functions 5// 6exports.helloWorld = functions.https.onRequest((request, response) => { 7 functions.logger.info("Hello logs!", {structuredData: true}); 8 response.send("Hello from Firebase!"); 9}); 10
そしたら以下のエラーが
takagifumiya@takagifumiyanoMacBook-Pro test % cd functions takagifumiya@takagifumiyanoMacBook-Pro functions % npm run deploy npm WARN npm npm does not support Node.js v12.16.1 npm WARN npm You should probably upgrade to a newer version of node as we npm WARN npm can't make any promises that npm will work with this version. npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10. npm WARN npm You can find the latest version at https://nodejs.org/ > functions@ deploy /Users/takagifumiya/Desktop/test/functions > firebase deploy --only functions === Deploying to 'test-c9cc4'... i deploying functions i functions: ensuring required API cloudfunctions.googleapis.com is enabled... i functions: ensuring required API cloudbuild.googleapis.com is enabled... ✔ functions: required API cloudfunctions.googleapis.com is enabled ⚠ functions: missing required API cloudbuild.googleapis.com. Enabling now... Error: Your project test-c9cc4 must be on the Blaze (pay-as-you-go) plan to complete this command. Required API cloudbuild.googleapis.com can't be enabled until the upgrade is complete. To upgrade, visit the following URL: https://console.firebase.google.com/project/test-c9cc4/usage/details npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! functions@ deploy: `firebase deploy --only functions` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the functions@ deploy script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! /Users/takagifumiya/.npm/_logs/2022-04-17T04_20_57_769Z-debug.log
調べた所、”プランをblazeにアップデートしろ”とのこと、
いやいや調べによるとcloud functionsは無料でできると聞かされていたのでおかしいと思いさらに調べると、”nodeのバージョンが10じゃないとダメだよ”みたいな記事を見ました。確かに私のnodeバージョンはv12.16.1でした。そしてnode v10系をインストールすることに。
node 10系をインスールできない
ここからが本題なのですが私のpcはmac m1なのですが、m1ではnodebrewを利用しても普通にインストールできなくcompileしなくてはいけないと知っていました。そこで以下のコマンドを実行
nodebrew compile v10.0.0
そしたらこんなエラーが
./configure: line 3: exec: python: not found
このエラーが解決出来なく詰まっています。どなたかこのエラーの解決法を教えてください。
環境
Mac M1
node v12.16.1
nodebrew v8.9.4
vdcode
その他ファイル
firebase.json
1{ 2 "functions": { 3 "source": "functions", 4 "runtime": "nodejs12" 5 }, 6 "database": { 7 "rules": "database.rules.json" 8 }, 9 "firestore": { 10 "rules": "firestore.rules", 11 "indexes": "firestore.indexes.json" 12 }, 13 "hosting": { 14 "public": "public", 15 "ignore": [ 16 "firebase.json", 17 "**/.*", 18 "**/node_modules/**" 19 ], 20 "rewrites": [ 21 { 22 "source": "**", 23 "destination": "/index.html" 24 } 25 ] 26 }, 27 "storage": { 28 "rules": "storage.rules" 29 }, 30 "emulators": { 31 "auth": { 32 "port": 9099 33 }, 34 "functions": { 35 "port": 5001 36 }, 37 "firestore": { 38 "port": 8080 39 }, 40 "database": { 41 "port": 9000 42 }, 43 "hosting": { 44 "port": 5000 45 }, 46 "pubsub": { 47 "port": 8085 48 }, 49 "storage": { 50 "port": 9199 51 }, 52 "ui": { 53 "enabled": true 54 } 55 }, 56 "remoteconfig": { 57 "template": "remoteconfig.template.json" 58 } 59}
fnctions/package.json
1{ 2 "name": "functions", 3 "description": "Cloud Functions for Firebase", 4 "scripts": { 5 "lint": "eslint .", 6 "serve": "firebase emulators:start --only functions", 7 "shell": "firebase functions:shell", 8 "start": "npm run shell", 9 "deploy": "firebase deploy --only functions", 10 "logs": "firebase functions:log" 11 }, 12 "engines": { 13 "node": "12" 14 }, 15 "main": "index.js", 16 "dependencies": { 17 "firebase-admin": "^10.0.2", 18 "firebase-functions": "^3.18.0" 19 }, 20 "devDependencies": { 21 "eslint": "^8.9.0", 22 "eslint-config-google": "^0.14.0", 23 "firebase-functions-test": "^0.2.0" 24 }, 25 "private": true 26} 27 28
よろしくお願いします。

回答1件
あなたの回答
tips
プレビュー