当我尝试运行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上。它与此有关吗?
环境:
答案 0 :(得分:0)
由于我看到很多人仍然遇到以下错误,请尝试将您的节点版本更新为最新的稳定版本(或> = 10)
答案 1 :(得分:0)
尝试使用其他端口。例子
firebase serve --port 3000 --only functions