问题描述
尝试从节点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的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!