将云功能更新为合适的 Node js 版本 [英] Updating cloud function to suitable Node js version

查看:13
本文介绍了将云功能更新为合适的 Node js 版本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

firebase FCM 通知的云功能在早期版本的 Node.js 8 上运行良好,但现在由于节点 8 已弃用并需要更新,我应该对云功能代码进行哪些更改,我已经在我的机器上安装了 Nodejs 14*

The cloud function for the firebase FCM notification which was working fine with the earlier version of Node.js 8 but now as the node 8 is deprecated and needs to be updated, what changes should I make to the cloud function code, I have already installed Nodejs 14* on my machine

推荐答案

您绝对需要进行的唯一更改根本不在您的代码中.最低限度,您应该编辑您的 package.json 并确保目标节点版本为 10:

The only change you're absolutely required to make is not in your code at all. Minimally, you should edit your package.json and make sure that the target node version is 10:

  "engines": {
    "node": "10"
  },

只需重新部署函数即可使用 node 10 运行时.

Simply redeploy the function to use the node 10 runtime.

阅读有关迁移的更多信息你的函数到节点 10.

这篇关于将云功能更新为合适的 Node js 版本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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