Node.js版本和Google Cloud功能

Leo*_*Leo 13 node.js npm firebase google-cloud-functions firebase-cli

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

警告:您使用的是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
Run Code Online (Sandbox Code Playgroud)

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


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

Dou*_*son 11

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