Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Best way to edit package.json file for Firebase Cloud Functions?

I get a parsing error when attempting to deploy a cloud function that the firebase-tools module cannot be found. I looked in my package.json file and notice that it’s missing, so I want to add it. I also noticed that the other dependencies have versions specified.

Are these version numbers updated automatically when I update my cloud functions through the CLI with npm install --save firebase-functions@latest?

And what is the proper way for me to add firebase-tools as a dependency? Do I specify a version number?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

{
  "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": "16"
  },
  "main": "index.js",
  "dependencies": {
    "firebase-admin": "^10.0.2",
    "firebase-functions": "^3.20.1"
  },
  "devDependencies": {
    "eslint": "^8.9.0",
    "eslint-config-google": "^0.14.0",
    "firebase-functions-test": "^0.2.0"
  },
  "private": true
}

>Solution :

The common way is to use NPM, the NodeJS package manager:

npm install -g firebase-tools

Where switch -g means global (available to all projects), not referenced inside package.json.
Also see: https://www.npmjs.com/package/firebase-tools …which reads version 11.0.0.

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading