1

What is the correct way to update Firebase Emulators after upgrading your local Node version?

After recently updating Node, the Firebase emulator throws the following warning when starting up:

Your requested "node" version "16" doesn't match your global version "18". Using node@18 from host.

The emulators still run without issue, but I'd like to prevent the warning going forward.

So far I've tried:

  • Deleting the yarn/package.lock file + node_modules
  • Then (re)running firebase init
    • Firebase docs: "This command starts a configuration wizard that lets you select emulators of interest, download the corresponding emulator binary files..."
    • Also suggested in this question
  • Then reinstalling the npm modules (i.e., yarn / npm -i)
warfield
  • 624
  • 6
  • 14

1 Answers1

0

Inside the functions folder there is a package.json file with a declared "engine" version like so:

  "engines": {
    "node": "16"
  },

This lets you specify what version of Node the code will execute as. See this link for more info about the engines property: https://docs.npmjs.com/cli/v9/configuring-npm/package-json#engines

To suppress the warning you can specify a version that matches your current Node version or use an asterisk. For me it looks like this:

node --version

v18.13.0

  "engines": {
    "node": ">=18"
  }
Chris
  • 846
  • 6
  • 16