Firebase 函数部署到模拟器时出错

mis*_*iac 1 firebase google-cloud-functions

我正在尝试使用最新版本的软件包启动新的 Firebase Functions 项目。

\n\n

我已按照本教程进行操作https://youtu.be/DYfP-UIKxH0进行操作:

\n\n
    \n
  1. Firebase 登录
  2. \n
  3. Firebase 初始化
  4. \n
  5. 创建函数项目的方式与教程所述相同
  6. \n
  7. 未注释的index.ts内容
  8. \n
  9. 之后我收到此错误:
  10. \n
\n\n

Starting @google-cloud/functions-emulator\n[2018-04-04T19:05:12.124Z] Parsing function triggers\n[2018-04-04T19:05:12.404Z] Error while deploying to emulator: TypeError: Cannot read property \'call\' of undefined\nTypeError: Cannot read property \'call\' of undefined\n at Promise (/usr/local/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:34:42)\n at getService.then (/usr/local/lib/node_modules/firebase-tools/node_modules/@google-cloud/functions-emulator/src/client/rest-client.js:33:16)\n at process._tickDomainCallback (internal/process/next_tick.js:135:7)\n\xe2\x9a\xa0 functions: Failed to emulate helloWorld

\n\n

我有最新的功能模拟器 *1.0.0-beta4。\n所有其他库都是最新版本...

\n\n

我现在不知道如何更好地调试这个问题以及如何解决这个问题

\n

小智 5

如果现有进程侦听端口 5000,则会出现此错误。请仔细检查是否有进程正在运行,例如在 Mac OS Sierra 上

sudo lsof -n -iTCP:5000 | grep LISTEN
Run Code Online (Sandbox Code Playgroud)

停止此进程或在另一个端口上运行 firebase,例如

firebase -p 7777 serve --only functions
Run Code Online (Sandbox Code Playgroud)

无需重新安装软件包。错误消息没有帮助,我们花了一些时间来查找根本原因。