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

前端 未结 21 1653
野趣味
野趣味 2020-11-29 01:15

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 instal         


        
相关标签:
21条回答
  • 2020-11-29 01:45

    Using Windows 10, Bash
    This worked for me:

    1. npm get prefix // to find Path which for me it was C:\Users\User\AppData\Roaming\npm
    2. search "Environment Variables" which located in "System Properties".
    3. Under "System Variables", find the PATH variable, select it, and click "Edit". Click "New" and add the path found with the "npm get prefix" command earlier (which was for me C:\Users\User\AppData\Roaming\npm) Then click "Ok"
    4. Restart Bash

    firebase --version //to check firebase version

    0 讨论(0)
  • 2020-11-29 01:45

    For anyone using nvm the error could arise because you are on a different nvm version than you were on when you first installed firebase tools globally. That's what it was for me. When I restarted webstorm nvm switched to a different version.

    Run nvm list to check the version you are on and run nvm use x.x.x to switch to the right version where you installed firebase tools originally.

    0 讨论(0)
  • 2020-11-29 01:46

    if you installing firebase-tools using

    yarn global add firebase-tools
    

    i got same error then i got answer and execute this

    export PATH="$(yarn global bin):$PATH"
    

    and then i can do firebase login pretty well

    0 讨论(0)
  • 2020-11-29 01:48

    For anyone using MacOS Catalina 10.15.2 getting the bash PATH variable fixed the issue for me.

    Run:

    npm get prefix
    

    Then run:

    export PATH=/Users/userid/.npm-global/bin:$PATH
    

    Note: I recently upgraded from my old High Sierra MacBook Pro, and was confused as well.

    0 讨论(0)
  • 2020-11-29 01:51

    @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
    
    0 讨论(0)
  • 2020-11-29 01:54

    Adding to Durul Dalkanat's answer,

    Assuming you have executed npm install firebase-tools -g

    1. Firstly get the output of the command of npm get prefix.
    2. Open .bashrc file which is in the home directory and add alias <output of npm get prefix>/bin/firebase at the end of the file.
    3. Run source .bashrc in the home directory.

    Enjoy!

    The alias of firebase will be the actual firebase path in the main system and this solution should work flawlessly.

    0 讨论(0)
提交回复
热议问题