Node.js版本和Google Cloud功能 [英] Node.js version and Google Cloud functions

查看:88
本文介绍了Node.js版本和Google Cloud功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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

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

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

但是没有有关该怎么做的信息.我需要怎么做才能将Node.js降级到v6.11.5?我是否应该仅将该版本用于Firebase项目,并将最新版本的Node.js用于其他项目?在那种情况下我该怎么办?

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?

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

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

因此,我真的认为我不得不放弃Node.js.但是我不知道如何安全地做到这一点.嗯,看着 http://nodejs.org/我什至找不到版本v6.11.5?

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?

如果npm update --dev已解决问题,则仅在新项目中签入.它没有. (实际上没有更新的软件包.)

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

推荐答案

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

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.

这篇关于Node.js版本和Google Cloud功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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