尝试从节点8升级到节点10(instructions are simple),但是在尝试运行时仍然出错。 “ SyntaxError:意外的令牌'导出'”
我正在使用最新的工具(Firebase工具:8.9.2)和。我没有跑短毛绒。
有什么想法吗?
//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());
答案 0 :(得分:0)
您已将代码从exports.A = ...
更改为export const A
。
在the medium post you shared或official documentation中都提到需要进行此更改。
此外,该错误表明它不了解export
。
将其更改回exports.A
应该可以解决该问题。
您可以看到examples in the docs仍然是节点10的格式。