Firebase init "Node.js 8 has been deprecated."

Nelles picture Nelles · Jun 19, 2020 · Viewed 7.1k times · Source

When I run firebase init to start a new project the package.json file is created automatically (as below) when I go to the firebase dashboard it then throws this warning"

Starting NaN, NaN, we'll no longer support new deploys or updates of Node.js 8 functions.
Starting NaN, NaN, we'll no longer support executions of existing Node.js 8 functions.

how do you init and specify the version? Or what is the workaround?

{
  "name": "functions",
  "description": "Cloud Functions for Firebase",
  "scripts": {
    "lint": "eslint .",
    "serve": "firebase emulators:start --only functions",
    "shell": "firebase functions:shell",
    "start": "npm run shell",
    "deploy": "firebase deploy --only functions",
    "logs": "firebase functions:log"
  },
  "engines": {
    "node": "8"
  },
  "dependencies": {
    "firebase-admin": "^8.10.0",
    "firebase-functions": "^3.6.1"
  },
  "devDependencies": {
    "eslint": "^5.12.0",
    "eslint-plugin-promise": "^4.0.1",
    "firebase-functions-test": "^0.2.0"
  },
  "private": true
}

** moderator I did not come across similar questions because they way it was worded did not show up in google. This post per day traffic is evidence that it is helpful for the community** enter image description here

Answer

Danizavtz picture Danizavtz · Jun 19, 2020

You have to change your package.json

Where you have:

"engines": {
    "node": "8"
  }

change to:

"engines": {
    "node": "10"
  },

As stated by firebase documentation.