firebase-tools "-bash: firebase: command not found"

Excited that Firebase's hosting is now out of beta. Trying to get going with with the firebase-tools package and I've successfully installed it:

npm install -g firebase-tools

Trying to run any tool fails with

-bash: firebase: command not found

I've tried putting the following command in my .bash_profile without any luck

export PATH=/usr/local/share/npm/bin:$PATH

Any ideas? Pretty new to the command line in general.

Thanks!


Solution 1:

Run code below with terminal,

alias firebase="`npm config get prefix`/bin/firebase"

Solution 2:

Installing firebase-tools globally did the trick for me :

npm install -g firebase-tools

Solution 3:

You should add the npm bin folder to your bash PATH variable. To do that, run:

npm get prefix

And it should output something like /home/your-username/npm-global.

Then in your ~/.bashrc or ~/.bash_profile (if you're in a Mac) file, add:

export PATH="/home/your-username/npm-global/bin:$PATH" # Add npm bin PATH

Note the "/bin" after the npm get prefix result.

Solution 4:

@mklement0 That answer looks good, but I'm worried it will be intimidating to someone who is so new to the command line. So I'm going to cherry-pick the most relevant piece of it.

@cienki Run this command to see what you should be putting in that PATH prefix in your .bash_profile file:

npm get prefix