无法将云功能升级到节点10 [英] Can't upgrade Cloud Functions to Node 10

查看:54
本文介绍了无法将云功能升级到节点10的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试从节点8升级到节点10(指令很简单),但是在尝试运行例如时仍然会出错. " SyntaxError:意外的令牌导出""

Tried upgrading from Node 8 to Node 10 (instructions are simple), but still get errors when attempting to run eg. "SyntaxError: Unexpected token 'export'"

我正在使用最新的工具(Firebase工具:8.9.2)和.我没有跑短毛绒.

I'm using most updated tooling (Firebase Tools: 8.9.2) and . I'm not running a linter.

有什么想法吗?

//relevant files in package.json:
{
  "engines": {
    "node": "10"
  },
  "dependencies": {
    "firebase-admin": "^8.10.0",
    "firebase-functions": "^3.11.0",
  },
}

代码比较

//previous code in node 8, does not error
exports.A = functions.pubsub
  .schedule("0 22 * * *")
  .onRun(() => bigQueryDump());

//code in node 10, throws error
export const A = functions.pubsub
  .schedule("0 22 * * *")
  .onRun(() => bigQueryDump());

推荐答案

您已将代码从exports.A = ...更改为export const A.

您分享的中级帖子官方文档提到此更改是必需的.

In either the medium post you shared nor the official documentation is mentioned that this change is required.

此外,该错误表明它不了解export.

Furthermore, the error suggests that it is not understanding export.

将其更改回exports.A应该可以解决该问题.

Changing this back to exports.A should fix that issue.

您可以看到示例在文档中,它仍然是节点10的格式.

You can see the examples in the docs that this is still the format for node 10.

这篇关于无法将云功能升级到节点10的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆