我试图启动本地的firebase模拟器来测试云函数,但是当我使用命令"firebase模拟器: start“或"firebase模拟器:启动函数”“I get a”错误时:出现了一个意外的错误“”。深入查看日志,我发现出现了一个javascript错误:
at new Table (/usr/local/lib/node_modules/firebase-tools/node_modules/cli-table/lib/index.js:51:15)
at Command.actionFn (/usr/local/lib/node_modules/firebase-tools/lib/commands/emulators-start.js:47:33)
at processTicksAndRejections (internal/process/task_queues.js:93:5)在这个问题上你能帮我一下吗?
我的firebase.debug文件:
[debug] [2021-11-18T14:17:55.225Z] ----------------------------------------------------------------------
[debug] [2021-11-18T14:17:55.227Z] Command: /usr/local/bin/node /usr/local/bin/firebase emulators:start --only functions
[debug] [2021-11-18T14:17:55.228Z] CLI Version: 9.22.0
[debug] [2021-11-18T14:17:55.228Z] Platform: darwin
[debug] [2021-11-18T14:17:55.228Z] Node Version: v14.16.1
[debug] [2021-11-18T14:17:55.228Z] Time: Thu Nov 18 2021 11:17:55 GMT-0300
[debug] [2021-11-18T14:17:55.228Z] ----------------------------------------------------------------------
[debug]
[debug] [2021-11-18T14:17:55.279Z] > command requires scopes: ["email","openid","https://www.googleapis.com/auth/cloudplatformprojects.readonly","https://www.googleapis.com/auth/firebase","https://www.googleapis.com/auth/cloud-platform"]
[debug] [2021-11-18T14:17:55.279Z] > authorizing via signed-in user
[info] i emulators: Starting emulators: functions {"metadata":{"emulator":{"name":"hub"},"message":"Starting emulators: functions"}}
[warn] ⚠ emulators: It seems that you are running multiple instances of the emulator suite for project myproject-cloud. This may result in unexpected behavior.
[debug] [2021-11-18T14:17:55.296Z] [hub] writing locator at /var/folders/fh/z2w8wkl147gd2q4wvc281x5r0000gn/T/hub-myproject-cloud.json
[warn] ⚠ functions: The following emulators are not running, calls to these services from the Functions emulator will affect production: auth, firestore, database, hosting, pubsub, storage {"metadata":{"emulator":{"name":"functions"},"message":"The following emulators are not running, calls to these services from the Functions emulator will affect production: \u001b[1mauth, firestore, database, hosting, pubsub, storage\u001b[22m"}}
[info] ✔ functions: Using node@14 from host. {"metadata":{"emulator":{"name":"functions"},"message":"Using node@14 from host."}}
[debug] [2021-11-18T14:17:55.335Z] defaultcredentials: writing to file /Users/artiste/.config/firebase/artiste_gmail_com_application_default_credentials.json
[debug] [2021-11-18T14:17:55.339Z] Setting GAC to /Users/artiste/.config/firebase/artiste_gmail_com_application_default_credentials.json {"metadata":{"emulator":{"name":"functions"},"message":"Setting GAC to /Users/artiste/.config/firebase/artiste_gmail_com_application_default_credentials.json"}}
[debug] [2021-11-18T14:17:55.342Z] >>> [apiv2][query] GET https://firebase.googleapis.com/v1beta1/projects/myproject-cloud/adminSdkConfig [none]
[debug] [2021-11-18T14:17:56.394Z] <<< [apiv2][status] GET https://firebase.googleapis.com/v1beta1/projects/myproject-cloud/adminSdkConfig 200
[debug] [2021-11-18T14:17:56.394Z] <<< [apiv2][body] GET https://firebase.googleapis.com/v1beta1/projects/myproject-cloud/adminSdkConfig {"projectId":"myproject-cloud","storageBucket":"myproject-cloud.appspot.com","locationId":"southamerica-east1"}
[warn] ⚠ ui: Emulator UI unable to start on port 4000, starting on 4010 instead. {"metadata":{"emulator":{"name":"ui"},"message":"Emulator UI unable to start on port 4000, starting on 4010 instead."}}
[debug] [2021-11-18T14:17:56.965Z] Ignoring unsupported arg: auto_download {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: auto_download"}}
[debug] [2021-11-18T14:17:56.965Z] Ignoring unsupported arg: port {"metadata":{"emulator":{"name":"ui"},"message":"Ignoring unsupported arg: port"}}
[debug] [2021-11-18T14:17:56.965Z] Starting Emulator UI with command {"binary":"node","args":["/Users/artiste/.cache/firebase/emulators/ui-v1.6.4/server.bundle.js"],"optionalArgs":[],"joinArgs":false} {"metadata":{"emulator":{"name":"ui"},"message":"Starting Emulator UI with command {\"binary\":\"node\",\"args\":[\"/Users/artiste/.cache/firebase/emulators/ui-v1.6.4/server.bundle.js\"],\"optionalArgs\":[],\"joinArgs\":false}"}}
[info] i ui: Emulator UI logging to ui-debug.log {"metadata":{"emulator":{"name":"ui"},"message":"Emulator UI logging to \u001b[1mui-debug.log\u001b[22m"}}
[debug] [2021-11-18T14:17:57.055Z] Web / API server started at localhost:4010
{"metadata":{"emulator":{"name":"ui"},"message":"Web / API server started at localhost:4010\n"}}
[info] i functions: Watching "/Users/artiste/Developer/myproject_functions/functions" for Cloud Functions... {"metadata":{"emulator":{"name":"functions"},"message":"Watching \"/Users/artiste/Developer/myproject_functions/functions\" for Cloud Functions..."}}
[debug] [2021-11-18T14:17:57.241Z] [worker-pool] addWorker(~diagnostic~) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] addWorker(~diagnostic~)"}}
[debug] [2021-11-18T14:17:57.241Z] [worker-pool] Adding worker with key ~diagnostic~, total=1 {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] Adding worker with key ~diagnostic~, total=1"}}
[debug] [2021-11-18T14:17:57.242Z] [worker-pool] submitWork(triggerId=) {"metadata":{"emulator":{"name":"functions"},"message":"[worker-pool] submitWork(triggerId=)"}}
[debug] [2021-11-18T14:17:57.242Z] [worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: Assigning socketPath: /var/folders/fh/z2w8wkl147gd2q4wvc281x5r0000gn/T/fire_emu_52240.sock {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: Assigning socketPath: /var/folders/fh/z2w8wkl147gd2q4wvc281x5r0000gn/T/fire_emu_52240.sock"}}
[debug] [2021-11-18T14:17:57.242Z] [worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: BUSY {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: BUSY"}}
[debug] [2021-11-18T14:17:57.363Z] [runtime-status] [52240] Functions runtime initialized. {"cwd":"/Users/artiste/Developer/myproject_functions/functions","node_version":"14.16.1"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Functions runtime initialized. {\"cwd\":\"/Users/artiste/Developer/myproject_functions/functions\",\"node_version\":\"14.16.1\"}"}}
[debug] [2021-11-18T14:17:57.364Z] [runtime-status] [52240] Disabled runtime features: undefined {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Disabled runtime features: undefined"}}
[debug] [2021-11-18T14:17:57.367Z] [runtime-status] [52240] Resolved module firebase-admin {"declared":true,"installed":true,"version":"9.12.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-admin {\"declared\":true,\"installed\":true,\"version\":\"9.12.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.370Z] [runtime-status] [52240] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.16.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.16.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.372Z] [runtime-status] [52240] Outgoing network have been stubbed. [{"name":"http","status":"mocked"},{"name":"http","status":"mocked"},{"name":"https","status":"mocked"},{"name":"https","status":"mocked"},{"name":"net","status":"mocked"}] {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Outgoing network have been stubbed. [{\"name\":\"http\",\"status\":\"mocked\"},{\"name\":\"http\",\"status\":\"mocked\"},{\"name\":\"https\",\"status\":\"mocked\"},{\"name\":\"https\",\"status\":\"mocked\"},{\"name\":\"net\",\"status\":\"mocked\"}]"}}
[debug] [2021-11-18T14:17:57.372Z] [runtime-status] [52240] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.16.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.16.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.429Z] [runtime-status] [52240] Checked functions.config() {"config":{}} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Checked functions.config() {\"config\":{}}"}}
[debug] [2021-11-18T14:17:57.429Z] [runtime-status] [52240] firebase-functions has been stubbed. {"functionsResolution":{"declared":true,"installed":true,"version":"3.16.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js"}} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] firebase-functions has been stubbed. {\"functionsResolution\":{\"declared\":true,\"installed\":true,\"version\":\"3.16.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js\"}}"}}
[debug] [2021-11-18T14:17:57.430Z] [runtime-status] [52240] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.16.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.16.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.430Z] [runtime-status] [52240] Resolved module firebase-admin {"declared":true,"installed":true,"version":"9.12.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-admin {\"declared\":true,\"installed\":true,\"version\":\"9.12.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.431Z] [runtime-status] [52240] Resolved module firebase-functions {"declared":true,"installed":true,"version":"3.16.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] Resolved module firebase-functions {\"declared\":true,\"installed\":true,\"version\":\"3.16.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-functions/lib/index.js\"}"}}
[debug] [2021-11-18T14:17:57.431Z] [runtime-status] [52240] firebase-admin has been stubbed. {"adminResolution":{"declared":true,"installed":true,"version":"9.12.0","resolution":"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js"}} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] firebase-admin has been stubbed. {\"adminResolution\":{\"declared\":true,\"installed\":true,\"version\":\"9.12.0\",\"resolution\":\"/Users/artiste/Developer/myproject_functions/functions/node_modules/firebase-admin/lib/index.js\"}}"}}
[debug] [2021-11-18T14:17:57.433Z] [runtime-status] [52240] initializeApp(DEFAULT) {"storageBucket":"myproject-cloud.appspot.com","projectId":"myproject-cloud"} {"metadata":{"emulator":{"name":"functions"},"message":"[runtime-status] [52240] initializeApp(DEFAULT) {\"storageBucket\":\"myproject-cloud.appspot.com\",\"projectId\":\"myproject-cloud\"}"}}
[debug] [2021-11-18T14:17:57.436Z] addAuthTrigger {"eventTrigger":{"resource":"projects/myproject-cloud","eventType":"providers/firebase.auth/eventTypes/user.create","service":"firebaseauth.googleapis.com"}}
[info] ✔ functions[us-central1-createWallet]: auth function initialized. {"metadata":{"emulator":{"name":"functions"},"message":"\u001b[1mauth\u001b[22m function initialized."}}
[info] ✔ functions[us-central1-addMessage]: http function initialized (http://localhost:5001/myproject-cloud/us-central1/addMessage). {"metadata":{"emulator":{"name":"functions"},"message":"\u001b[1mhttp\u001b[22m function initialized (http://localhost:5001/myproject-cloud/us-central1/addMessage)."}}
[info] i functions[us-central1-makeUppercase]: function ignored because the firestore emulator does not exist or is not running. {"metadata":{"emulator":{"name":"functions"},"message":"function ignored because the firestore emulator does not exist or is not running."}}
[debug] [2021-11-18T14:17:57.440Z] [worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: IDLE {"metadata":{"emulator":{"name":"functions"},"message":"[worker-~diagnostic~-ef847c42-9516-4e42-bacf-72e8e9feb533]: IDLE"}}
[debug] [2021-11-18T14:17:57.687Z] TypeError: Cannot read property 'rows' of undefined
at new Table (/usr/local/lib/node_modules/firebase-tools/node_modules/cli-table/lib/index.js:51:15)
at Command.actionFn (/usr/local/lib/node_modules/firebase-tools/lib/commands/emulators-start.js:47:33)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
[error]
[error] Error: An unexpected error has occurred.我的firebase.json文件:
{
"functions": {
"predeploy": [
"npm --prefix \"$RESOURCE_DIR\" run lint",
"npm --prefix \"$RESOURCE_DIR\" run build"
]
},
"firestore": {
"rules": "firestore.rules",
"indexes": "firestore.indexes.json"
},
"hosting": {
"public": "dist",
"ignore": ["firebase.json", "**/.*", "**/node_modules/**"],
"rewrites": [
{
"source": "**",
"destination": "/index.html"
}
]
},
"emulators": {
"firestore": {
"port": 5002
}
}
}谢谢。
发布于 2021-11-19 19:35:23
这似乎是Firebase中的一个bug。在更新到最新版本(9.23.0)之后,它就消失了,例如:
npm i -g firebase-tools@latesthttps://stackoverflow.com/questions/70021730
复制相似问题