I'm trying to build an app with Firebase and ran a few commands to see which version I have. To follow along with a 2021 instruction video, I was hoping to have Firebase v9. Depending on the command that I run, I somehow have versions 8 and 11. If I have these two versions, which one is actually being used? What is the difference between seemingly having an npm firebase and non-npm firebase installed?
armadillo@armadillo-MacBook-Air my-app % npm firebase --version
8.11.0
armadillo@armadillo-MacBook-Air my-app % firebase -V
11.2.2
CodePudding user response:
If you're trying to work with the Firebase CLI, you should be looking at the firebase-tools npm package, not firebase. They are definitely not the same thing.
npm firebase-tools --version
I suggest reviewing the documentation as well.
CodePudding user response:
As covered by @Doug's answer, the firebase
command is defined by the firebase-tools
npm package (or by https://firebase.tools if installed that way) not the firebase
package, which does not define any command line utilities.
Additionally, npm --version
returns the version of npm
you have installed. This includes if you add the name of a package there. (i.e. npm thisCouldBeAnythingNotANPMCommand --version
will return the same result)
If you want to view the version of a deployed package, you would use one of the following commands to query NPM's database:
npm view firebase version (view package's "version" field)
npm v firebase version (view package's "version" field, using shorthand)
npm view firebase (get all available package information)
If you want to view the version of a package installed in your project or globally, you would use:
npm ls firebase (local install)
npm ls -g firebase-tools (global install)
If you want to view the where the npm-installed commands are, you would use:
npm bin (local install)
npm bin -g (global install)
For the firebase
command, the firebase
/firebase.cmd
/firebase.ps1
files all point to <global bin directory>/node_modules/firebase-tools/lib/bin/firebase.js
.
Compare the results of:
> npm v firebase version
9.9.0
> npm ls firebase
`-- [email protected] (an old project directory for another SO answer)
> npm v firebase-tools version
11.2.2
> npm ls -g firebase-tools
`-- [email protected] (updated since :D)
> npm --version
6.4.12
> npm firebase --version
6.4.12
> npm v npm version
8.14.0 (updated since :D)