firebase-functions: Can't serve firebase-functions locally, even with Node v6.11

firebase-functions@0.5.9 firebase-tools@3.9.1 firebase-admin@4.2.1

Test case

Trying to serve functions locally

Steps to reproduce

Install nvm nvm use v6.9.1 install dependencies now run: firebase serve --only functions

Expected behavior

That the functions are hosted locally

Actual behavior

The log file is deleted, but I get this output:

=== Serving from ‘/Users/alexbjorlig/Documents/Github/amentoCph’…

i functions: Preparing to emulate HTTPS functions. Support for other event types coming soon. Node.js v6.11.x or greater is required to run the Emulator! ⚠ 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. Please note that emulation of custom config values are not supported yet. Run firebase serve --only hosting to only serve hosting files.

Error: Emulator crashed! Check the log file… i functions: No HTTPS functions emulated. Support for other function types are coming soon.

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Reactions: 11
  • Comments: 66 (13 by maintainers)

Most upvoted comments

is this resolved? still getting the same problem

Hey everyone, we are working on a new Node 8 runtime and will support it soon. You will have the option to pick between Node 6 and Node 8 and won’t be forced to upgrade.

Hey everyone, Node 8 is now available with the latest SDK and CLI, learn more at https://firebase.google.com/docs/functions/manage-functions#set_nodejs_version

A note for anyone here using TypeScript like I was: you need to run npm run build in the functions directory before running serve.

Same error, and my node is v6.11.

on nvm 6.11.1 npm uninstall -g firebase-tools npm install -g firebase-tools nvm use 6.11.5 Finally resolved it for me

Great ! Please also consider :

After trying just about everything, ps ax | grep firebase , kill -9 xxxx all existing firebase processes and running firebase serve again did the trick.

Are you using nvm? If so, use the following:

nvm install 6.11.5

and then give it a try. Hope that helps!

Thanks for the update! Error messaging fixed here https://github.com/firebase/firebase-tools/pull/490

@jasenkoh @tysonnero Does the problem go away if you update to 6.11.1?

For those that this may help, running firebase serve at the same time as firebase functions:shell will result in these errors.

Thanks to @isabellachen.

I still have same issue. Changing to node 6.11.5 had no effect, same issue.

Firebase worked great for my other project. Now I am not even able to start a new firebase project on Windows.

@prakis I would recommend using n (or, alternatively, nvm) when developing with firebase-functions, making sure to using v6.11.x — This is what I’ve done to get around other issues. Using a transpiler like Babel can help polyfill/transpile features that don’t exist in v6.11.x that you may need to leverage.

When developing a firebase-functions application:

$ n 6.11.5
$ node -v
v6.11.5

Other usage examples:

$ n lts
$ node -v
v8.11.3
$ n latest
$ node -v
v10.7.0

It’s an extra step, but a solution nonetheless, one that I use without issues.

@LaZeR30 The NodeJS team has a Release repo where you can review the planned lifespan of each LTS release.

Right now, v6.x.x has a sunset date of April 2019.

Because Firebase Functions needs to continue to support a wide-array of customers that rely on certain versions of node, upgrading is a much more in-depth process that involves active involvement from every single user of Firebase Functions in order to ensure production instances of presently deployed applications aren’t affected in the long term from changing LTS version. Although Node v8.x.x has moved into LTS, it won’t officially take over until April 2019, at which point the NodeJS team cannot ensure v6.x.x.

My assumption would be that early next year we’ll start seeing emails from Google about a forced upgrade from v6.x.x to v8.x.x Correction: @laurenzlong Mentioned below that a new Node 8 runtime will be supported soon, and there will be no forced upgrade.

If you’re having trouble with it on your local machine, I use the n NPM package to switch between versions quickly when I’m developing among multiple applications that rely on varying node engines.

Check it out: https://npmjs.com/package/n

Is Firebase going to upgrade to Node v8.11.1 ??

Yep, I discovered that my code had issues, but that the error wasn’t being displayed. I had to add a console.log inside of parseTriggers to see the actual error text. Perhaps we could just ensure that gets to the screen for the developer?

@aliparr- I did get this message too but I get only a warning now: Warning: You’re using Node.js v8.6.0 but Google Cloud Functions only supports v6.11.1.

Other version numbers at me: npm: 5.3.0 firebase-tools: 3.12.0 firebase-admin 5.2.1 firebase-functions 0.6.3

Here’s what I did:

functions stop
npm uninstall -g @google-cloud/functions-emulator
rm ~/.config/configstore/@google-cloud/functions-emulator
npm uninstall -g firebase-tools
npm cache clean -f
rm -rf functions/node_modules
npm i -g firebase-tools
npm i -g @google-cloud/functions-emulator
cd functions
npm i

Hope this helps.

I updated my node version to v8.6.0 and all of my problems were gone.

@DenisCangemi @aliparr- Were you able to deploy these functions successfully?