15

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

Warning: You're using Node.js v8.9.4 but Google Cloud Functions only supports 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?


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?


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

Leo
  • 4,136
  • 6
  • 48
  • 72

5 Answers5

12

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.

Doug Stevenson
  • 297,357
  • 32
  • 422
  • 441
  • There seem to be some trouble (see Node.js v8 support for cloud functions [66770141] - https://issuetracker.google.com/issues/66770141). I have no idea exactly what does not work because of this, but it happened to me that something that did work locally did not work at the deployed server. – Leo Apr 25 '18 at 01:33
  • 1
    Maybe you used a language feature that was not available in node 6, such as async/await. There are no problems if you stick to things supported by node 6. – Doug Stevenson Apr 25 '18 at 02:16
  • Maybe. But I did not use async/await myself. Unsupported features might be in some modules though. Is there any way to find out? Any tool to check this with? – Leo Apr 25 '18 at 11:30
  • I just tried to deploy a scheduled function with a newer node version in my local machine and it was rejected with obscure error messages. The Firebase support team asked me to downgrade the node version and it worked.. The catch here is that log messages don't often point in the right direction :/ – sjsam Feb 12 '21 at 18:54
2

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’.

  • Thanks, but I do not think that will help here. It does not tell how to downgrade Node.js. – Leo May 17 '18 at 17:10
  • 1
    @Leo - You need to reinstall the Node.js to downgrade by specifying the version number during installation, 6.11.5 for you, as described here https://www.abeautifulsite.net/how-to-upgrade-or-downgrade-nodejs-using-npm. Hope this helps. – Amruth Bahadursha May 17 '18 at 19:02
  • Thanks, that looks like what I am looking for. I assume that `n` here is `node`? (`sudo n stable`, `sudo n 4.4.2`, `sudo npm install -g n`) There is no command `n` when running this on Windows. – Leo May 18 '18 at 14:57
  • @Leo - Here are the commands to install on Windows, including commands to install the specific version. https://github.com/felixrieseberg/npm-windows-upgrade – Amruth Bahadursha May 18 '18 at 16:47
2

Node v8 is now available for cloud functions: https://firebase.googleblog.com/2018/08/cloud-functions-for-firebase-config-node-8-timeout-memory-region.html

So I believe this warning can truly be ignored...

Brian Ogden
  • 18,439
  • 10
  • 97
  • 176
1

There are several tools listed in the answers to this question

For Windows I just used nvmw successfully to accomplish this same task.

easycheese
  • 5,859
  • 10
  • 53
  • 87
1

You will get the nvm here

After installation of nvm. just use this command "nvm install 8.9.1 64bit" you can use any version here or 64bit 32bit according to your system config after that installation use "nvm use 8.9.1"

Usama Tahir
  • 1,235
  • 12
  • 14