[当我使用firebase serve
启动本地Firebase服务器时收到此消息:
警告:您正在使用Node.js v8.9.4,但Google Cloud Functions仅支持v6.11.5。
但是没有关于该怎么做的信息。我需要做什么才能将Node.js降级到v6.11.5?我是否应该仅将该版本用于Firebase项目,并将最新版本的Node.js用于其他项目?在那种情况下我该怎么做?
编辑:警告现在看起来像这样,我无法运行一个新的几乎为空的项目:
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
因此,我真的认为我不得不放弃Node.js。但是我不知道如何安全地做到这一点。嗯,看着http://nodejs.org/我什至找不到版本v6.11.5?
编辑2:如果npm update --dev
已解决问题,则仅在新项目中签入。它没。 (实际上没有更新的软件包。)
这只是警告。如果您知道自己在做什么,则可以忽略它。告诉您,对函数的本地仿真(在节点8.9.4上运行)可能与将函数部署到Cloud Functions(运行6.11.5)时的功能完全不匹配。但是,只要您不使用节点6.11.5上不可用的节点功能,就不会有问题。我一直使用较新版本的node进行本地测试,而不会出现问题。
您可以使用GitHub Troubleshooting指南中提供的命令来卸载和重新安装Cloud Functions emulator和Firebase Tools。由于您使用的是Firebase,请按照“ Firebase工具”的说明进行操作。
Node v8现在可用于云功能:https://firebase.googleblog.com/2018/08/cloud-functions-for-firebase-config-node-8-timeout-memory-region.html
所以我相信这个警告可以被忽略...
question的答案中列出了几种工具>
对于Windows,我只是成功地使用nvmw来完成相同的任务。