Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Firebase CLI: "functions: WARNING! NO ENGINES FIELD FOUND IN PACKAGE.JSON. DEFAULTING TO NODE 6 RUNTIME."

I upgraded my Firebase CLI to version 6.8.0. Now, when I deploy my functions, I get a warning message that looks like this:

⚠ functions: WARNING! NO ENGINES FIELD FOUND IN PACKAGE.JSON. DEFAULTING TO NODE 6 RUNTIME. Starting June 1, 2019 deployments will be blocked if no engines field is specified in package.json. To fix this, add the following lines to your package.json:

 "engines": {
   "node": "6"
 }

What should I do to avoid this error message?

like image 385
Doug Stevenson Avatar asked May 02 '19 21:05

Doug Stevenson


1 Answers

The nodejs 6 runtime on Cloud Functions is now deprecated and is being removed, as nodejs 6 has expired Long Term Support (LTS). You can see the LTS schedule for various versions of node here.

The message is displayed now because the Firebased CLI previously took node 6 as a default, but it doesn’t want to break your deployment. You will have to be explicit about which version of node you would like to target for deployment. You can take the advice of the warning message and specify node 6, but since node 6 is EOL, you should target at least node 8 instead, which is now out of beta.

To indicate which version of the node runtime you want, edit your package.json and include a new top-level child to it that looks like this, with a child called “engines”:

{
  // other configurations here…
  "dependencies": {
  },
  // Add an “engines” child to choose a node version, here it’s node 8.
  "engines": {
    "node": "8"
  }
}

This requirement is also reflected in the documentation and the default project template created by the Firebase CLI.

If you specifically target node 6, you will see this warning message instead:

⚠ functions: Deploying functions to Node 6 runtime, which is deprecated. Node 8 is available and is the recommended runtime.

like image 157
Doug Stevenson Avatar answered Sep 30 '22 05:09

Doug Stevenson