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?
{
"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
}
CodePudding user response:
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
.