Search code examples
node.jsfirebasenpmfirebase-cli

Using firebase cli when not installed globally


I'm using my work computer while developing a sort of side project. Nothing crazy just learning some new firebase stuff. Anyways, because it is a work computer I can't install modules globally. So when it came to installing firebase-cli I tried using the recommended global command:

npm install -g firebase-tools

That didn't work because I don't have permission due to this being a work computer. So I created a firebase folder just for this project and ran

npm install firebase-tools

In the new folder. Once finished I tried running

firebase -version

But this resulted in

firebase: command not found

I thought this would work since I'm in the directory I created and installed firebase in but it doesn't work. Any help please!


Solution

  • If you want to run any command from a package that was installed in a project, use npm exec from the project folder.

    npm exec -- firebase [CLI args]
    

    The version command you were trying to run would go like this (note it's two dashes for the flag)

    npm exec -- firebase --version