Firebase CLI:"functions: WARNING! NO ENGINES FIELD FOUND IN PACKAGE.JSON. DEFAULTING TO NODE 6 RUNTIME."
Firebase CLI: "functions: WARNING! NO ENGINES FIELD FOUND IN PACKAGE.JSON. DEFAULTING TO NODE 6 RUNTIME."
我将我的 Firebase CLI 升级到了 6.8.0 版。现在,当我部署我的函数时,我收到一条警告消息,如下所示:
⚠ functions: WARNING! NO ENGINES FIELD FOUND IN PACKAGE.JSON. DEFAULTING TO NODE 6 RUNTIME. Starting June 1, 2019 deployments will be blocked if no engines field is specified in package.json. To fix this, add the following lines to your package.json:
"engines": {
"node": "6"
}
我应该怎么做才能避免出现此错误消息?
Cloud Functions 上的 nodejs 6 运行时现已弃用并被删除,因为 nodejs 6 已过期长期支持 (LTS)。您可以看到各种节点版本的 LTS 计划 here。
现在显示该消息是因为 Firebased CLI 之前将节点 6 作为默认值,但它不想破坏您的部署。您必须明确说明要将哪个版本的节点作为部署目标。您可以采纳警告消息的建议并指定节点 6,但由于节点 6 已停产,因此您应该至少以节点 8 为目标,该节点现已结束测试。
要指示您想要哪个版本的节点运行时,请编辑您的 package.json 并在其中包含一个新的顶级子项,如下所示,其中一个子项称为“engines”:
{
// other configurations here…
"dependencies": {
},
// Add an “engines” child to choose a node version, here it’s node 8.
"engines": {
"node": "8"
}
}
此要求也反映在 documentation 和 Firebase CLI 创建的默认项目模板中。
如果您专门针对节点 6,您将看到此警告消息:
⚠ functions: Deploying functions to Node 6 runtime, which is deprecated. Node 8 is available and is the recommended runtime.
我将我的 Firebase CLI 升级到了 6.8.0 版。现在,当我部署我的函数时,我收到一条警告消息,如下所示:
⚠ functions: WARNING! NO ENGINES FIELD FOUND IN PACKAGE.JSON. DEFAULTING TO NODE 6 RUNTIME. Starting June 1, 2019 deployments will be blocked if no engines field is specified in package.json. To fix this, add the following lines to your package.json:
"engines": {
"node": "6"
}
我应该怎么做才能避免出现此错误消息?
Cloud Functions 上的 nodejs 6 运行时现已弃用并被删除,因为 nodejs 6 已过期长期支持 (LTS)。您可以看到各种节点版本的 LTS 计划 here。
现在显示该消息是因为 Firebased CLI 之前将节点 6 作为默认值,但它不想破坏您的部署。您必须明确说明要将哪个版本的节点作为部署目标。您可以采纳警告消息的建议并指定节点 6,但由于节点 6 已停产,因此您应该至少以节点 8 为目标,该节点现已结束测试。
要指示您想要哪个版本的节点运行时,请编辑您的 package.json 并在其中包含一个新的顶级子项,如下所示,其中一个子项称为“engines”:
{
// other configurations here…
"dependencies": {
},
// Add an “engines” child to choose a node version, here it’s node 8.
"engines": {
"node": "8"
}
}
此要求也反映在 documentation 和 Firebase CLI 创建的默认项目模板中。
如果您专门针对节点 6,您将看到此警告消息:
⚠ functions: Deploying functions to Node 6 runtime, which is deprecated. Node 8 is available and is the recommended runtime.