Node.js version and Google Cloud functions

时间:2022-08-11 15:47:39

I get this message when I start a local Firebase server with firebase serve:

当我使用firebase服务启动本地Firebase服务器时收到此消息:

Warning: You're using Node.js v8.9.4 but Google Cloud Functions only supports v6.11.5.

警告:您使用的是Node.js v8.9.4,但Google Cloud Functions仅支持v6.11.5。

But there is no info about what to do. What do I need to do to downgrade Node.js to v6.11.5? Should I use that version just for Firebase projects and the latest released version of Node.js for other projects? In that case how to I do that?

但是没有关于该做什么的信息。将Node.js降级到v6.11.5需要做什么?我应该仅针对Firebase项目使用该版本,还是针对其他项目使用最新发布的Node.js版本?在那种情况下我该怎么做?


EDIT: The warning now looks like this and I am unable to run a new nearly empty project:

编辑:警告现在看起来像这样,我无法运行一个新的几乎空的项目:

Warning: You're using Node.js v8.9.4 but Google Cloud Functions only supports v6.11.5.
!  functions: Failed to load functions source code. Ensure that you have the latest SDK by running npm i --save firebase-functions inside the functions directory.
!  functions: Error from emulator. mod.hasOwnProperty is not a function

So I really think I have to downgrande Node.js. But I do not know how to safely do that. Hm, looking at http://nodejs.org/ I can't even find version v6.11.5?

所以我真的认为我必须降级Node.js.但我不知道如何安全地做到这一点。嗯,看着http://nodejs.org/我甚至找不到版本v6.11.5?


EDIT 2: Just checked in the new project if npm update --dev fixed the problem. It did not. (Actually no packages where updated.)

编辑2:刚刚检查了新项目,如果npm update --dev修复了问题。它没。 (实际上没有更新的包。)

2 个解决方案

#1


5  

That's just a warning. You can ignore it if you know what you're doing. It's telling you that your local emulation of a function (running on node 8.9.4) may not perfectly match what the function will do when it's deployed to Cloud Functions (running 6.11.5). But as long as you're not using any features of node that are not available on node 6.11.5, you won't have a problem. I use newer versions of node to test locally all the time without problems.

那只是一个警告。如果你知道你在做什么,你可以忽略它。它告诉您,函数的本地仿真(在节点8.9.4上运行)可能与函数部署到云函数(运行6.11.5)时的功能完全匹配。但只要您不使用节点6.11.5上不可用的任何节点功能,就不会有问题。我使用较新版本的节点一直在本地测试而没有问题。

#2


1  

You can uninstall and reinstall Cloud Functions emulator and Firebase Tools using the commands provided in the GitHub Troubleshooting guide. Since you are using Firebase, follow the instruction for the ‘Firebase Tools’.

您可以使用GitHub故障排除指南中提供的命令卸载并重新安装Cloud Functions模拟器和Firebase工具。由于您使用的是Firebase,请按照“Firebase工具”的说明操作。

#1


5  

That's just a warning. You can ignore it if you know what you're doing. It's telling you that your local emulation of a function (running on node 8.9.4) may not perfectly match what the function will do when it's deployed to Cloud Functions (running 6.11.5). But as long as you're not using any features of node that are not available on node 6.11.5, you won't have a problem. I use newer versions of node to test locally all the time without problems.

那只是一个警告。如果你知道你在做什么,你可以忽略它。它告诉您,函数的本地仿真(在节点8.9.4上运行)可能与函数部署到云函数(运行6.11.5)时的功能完全匹配。但只要您不使用节点6.11.5上不可用的任何节点功能,就不会有问题。我使用较新版本的节点一直在本地测试而没有问题。

#2


1  

You can uninstall and reinstall Cloud Functions emulator and Firebase Tools using the commands provided in the GitHub Troubleshooting guide. Since you are using Firebase, follow the instruction for the ‘Firebase Tools’.

您可以使用GitHub故障排除指南中提供的命令卸载并重新安装Cloud Functions模拟器和Firebase工具。由于您使用的是Firebase,请按照“Firebase工具”的说明操作。