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

2019-01-08 17:28发布

问题:

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!

回答1:

@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


回答2:

Run code below with terminal,

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


回答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.



回答4:

Installing firebase-tools globally did the trick for me :

npm install -g firebase-tools


回答5:

Bruno's answer did the trick, I only needed to add a dot at npm-global in Ubuntu in .bashrc:

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


回答6:

Simply reinstall node.js. This worked for me and fire command was recognized.



回答7:

For Mac OS Sierra:

  1. $ sudo npm install -g firebase-tools
  2. To stop other Node process use $ ps aux | grep node
  3. If needed to upgrade or install emulator - $ npm install -g @google-cloud/functions-emulator
  4. Ready to go $ firebase --version


标签: bash firebase