''firebase' is not recognized as an internal or external command, operable program or batch file

I am in a bizarre problem, I just updated my Node.js and NPM at the date of 01-Feb-2019. And used the following command-

npm install -g firebase-tools

to install the Firebase CLI

Then on typing either of the code below

firebase login

or

firebase init

it is showing the following error

'firebase' is not recognized as an internal or external command, operable program or batch file.

Please help me. It has already consumed my two days.



Solution 1:[1]

npm install -g firebase-tools -f

Using -f for force install again. This work for me

Solution 2:[2]

add to .bash_profile export PATH="$PATH:/usr/local/bin" and run

npm install -g firebase-tools

this worked for me

Solution 3:[3]

If you are using MS Windows:

  1. Open Start Menu or press Win button on your keyboard.
  2. Type "variables".
  3. Click on "Edit the system environment variables"
  4. Click on "Environment Variables..." button.
  5. In the "System variables" list select "Path" and click on the "Edit..." button under the list.
  6. In the "Edit environment variable" dialog click on the "Browse..." button.
  7. Navigate to the c:\users\<yourusername>\AppData\Roaming\ dir and select the "npm" sub-dir, then click "OK".
  8. In the "Edit environment variable" dialog click "OK".
  9. In the "Environment Variables" dialog click on "OK".

For the Linux users:

  1. Navigate to the home_dir.
  2. Edit the hidden ".bash_profile" file.
  3. Add line with following text "export PATH="$PATH:/usr/local/bin".

Solution 4:[4]

Navigate to the firebase directory and call it out on the cmd.

  • run cmd as admin
  • cd C:\users\yourusername\AppData\Roaming\npm
  • firebase.cmd login or firebase login
  • firebase will prompt a google login after which the issue should be resolved.

There you go. above steps are all commands goes to your command prompt.

Solution 5:[5]

After running npm install -g firebase-tools, go to C:\usr\local. You will see Firebase files.

  1. Copy this path C:\usr\local to the clipboard.
  2. Open the Start Menu and search for Edit the System Environment Variables or simply env.
  3. Select the environment variables option that appears.
  4. Find the PATH variable under the system environment variables (lower section).
  5. Select PATH and click Edit
  6. Add C:\user\local to the beginning of the path.
  7. Add %APPDATA%\npm if it doesn't exist.
  8. Click OK to each of the windows until they're all closed.

After this, open a Windows command prompt and run firebase --version.

Solution 6:[6]

Make sure you are running command line as an administer.

Solution 7:[7]

Make sure you run the CMD in administrator mode. Also once you have run npm install -g firebase-tools commands close the CMD prompt and reopen again. If this doesn't work uninstall node and reinstall it again. It requires your node version to be a minimum version to support firebase.

Solution 8:[8]

After installing

$ npm install -g firebase-tools

Note the directory where it installed What I did was locate the directory where firebase was installed. In my case C:\usr\local then I copied the three firebase files. I also went into the node_modules folder and copied the firebase tools folder. Then I went to my app directory in file manager and pasted the firebase files, then created a new node_modules folder and pasted the firebase-tools folder.

Now go to your cmd and run

$ firebase init

It should work

Solution 9:[9]

My solution is to use Firebase CLI binary for Windows:

  1. Download CLI: https://firebase.google.com/docs/cli#install-cli-windows
  2. Run CLI, go to the project directory (cd 'your app path'). By the way, you may see the version: run "firebase --version" for that
  3. Run "firebase login" with Firebase CLI
  4. Run "firebase init" with Firebase CLI

Solution 10:[10]

Add this to the environment variable:-

C:\Users\<user>\AppData\Roaming\npm\firebase

it will allow firebase commands in ps/cmd

i dont think : C:\Users<user>\AppData\Roaming\npm\ now works.

Solution 11:[11]

For peeps like me who were unable to get rid of this problem after trying everything suggested above. I know it is late but I Fixed it by changing the location for installing my packages. I ran the command "npm config get prefix" in cmd and I found out that my default location for node_modules installation had been changed. so I set it back to default by "npm config set prefix "C:\Users\your_PC_Name\AppData\Roaming\npm". After that I used "npm install -g firebase-tools" again

My firebase package was installed. I was relieved to see firebase.cmd file in npm folder. Earlier I had tried every thing like uninstalling node.js and deleting npm and npm cache folders but all those methods didn't work for me.

Cannot get "npm install -g" to work on any packages (AppData/Roaming/npm always empty) this discussion worked for me only.

Solution 12:[12]

all of the Simple and Quick solution is here... step1): just go to C:\Users\your-user-name\AppData\Roaming\npm step2): copy the path of this "npm"-folder step3): now go to start and type "env" and select first-option then step4): now paste that path in "paths"-option by clicking on "edit"-button step5): then click on "ok" and restart your pc

Solution 13:[13]

I had similar issue in MAC. Terminal was giving me command not found message on running "firebase --version". So, I tried to reinstall the firebase with the command: "sudo npm i g firebase-tools" but it again errored out stating that the installed firebase binary file is corrupted.

Solution: STEP 1. Provide read, write and execute access with "sudo chmod a+rwx configstore" cmd to the path :

"/Users//.config/configstore/"

STEP 2. Run following command to update firebase:

sudo curl -sL firebase.tools | upgrade=true bash

Solution 14:[14]

Add C:\users\yourusername\AppData\Roaming\npm to your environment variable PATH.

Solution 15:[15]

For anyone still fighting this problem try to add the system environment path not to a user's environment.

Solution 16:[16]

https://github.com/firebase/firebase-tools/issues/46#issuecomment-615534999

  1. Run your cmd from C:\Windows\System32\cmd.exe or type this in your file path and hit Enter
  2. Just reinstall firebas-tools {npm i firebase-tools -g} globally
  3. Restart your computer its work for me good luck

Solution 17:[17]

Simple answer to this question is-
1.npm install firebase command in terminal window.
2.Add firebase scripts in your editor that you use.
3.set the Path in the environment system variable.

I think it will be able solve your problem...

Solution 18:[18]

1.After installing firebase globally via npm i -g firebase-tools

2.simply run all your firebase commands from the node command-line tool, it instantly worked for me.

3.To access the node command line, simply go to the start menu on windows and type "node.js command prompt"

Solution 19:[19]

My solution was that my project was on partition F: somedirectory/app, and when I moved it on partition C: Users/username/Documents/app It worked!

I tried everything mentioned and more, lost couple of hours.

So moving on partition where I installed: npm install -g firebase-tools then: firebase login, then: firebase init

Solution 20:[20]

npx firebase <your command>