gpt4 book ai didi

node.js - Firebase 的 Cloud Functions 无法模拟

转载 作者:行者123 更新时间:2023-12-04 02:28:58 24 4
gpt4 key购买 nike

当我尝试运行 npm run serve :

"build": "./node_modules/.bin/tsc",
"serve": "npm run build && firebase serve --only functions",

我得到一个输出,说它无法模拟我的功能:
> npm run build && firebase serve --only functions


> functions@ build /Users/eliyacohen/apps/app-name/functions
> tsc


=== Serving from '/Users/eliyacohen/apps/app-name'...

i functions: Preparing to emulate functions.
⚠ functions: Failed to emulate payment-create
⚠ functions: Failed to emulate payment-process

当我打开 firebase-debug.log有关更多信息,我看到:
...
Sat Mar 31 2018 18:48:05 GMT+0300 (IDT)
[debug] [2018-03-31T15:48:06.665Z] <<< HTTP RESPONSE 200
[debug] [2018-03-31T15:48:06.666Z] Starting @google-cloud/functions-emulator
[debug] [2018-03-31T15:48:08.254Z] Parsing function triggers
[debug] [2018-03-31T15:48:10.194Z] Error while deploy to emulator: Error: connect ECONNREFUSED 127.0.0.1:5001
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
[debug] [2018-03-31T15:48:10.195Z] Error while deploy to emulator: Error: connect ECONNREFUSED 127.0.0.1:5001
at Object.exports._errnoException (util.js:1020:11)
at exports._exceptionWithHostPort (util.js:1043:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1090:14)
[warn] ⚠ functions: Failed to emulate payment-create
[warn] ⚠ functions: Failed to emulate payment-process

据我了解,它无法到达 127.0.0.1:5001 所以它可以在本地提供这些功能?

我知道我的代码没有问题,因为 firebase deploy --only functions部署我的功能没有错误。

我试图完全删除 Node.js 并重新安装、降级和升级它。全局模块也是如此。

我的主文件夹 ( ../functions ) 建立在 Ionic Framework 之上。它与此有关吗?

环境:
  • 在 MacOS High Sierra 上运行
  • Node.js v6.11.5
  • NPM 版本 3.10.10
  • firebase-tools:3.17.7(全局)
  • firebase 管理员:^5.11.0,
  • firebase 功能:^0.9.1
  • 最佳答案

    由于我看到很多人仍然遇到以下错误,请尝试将您的 Node 版本更新为最新的稳定版本(或> = 10)

    关于node.js - Firebase 的 Cloud Functions 无法模拟,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49589740/

    24 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com