user10482273
user10482273

Reputation:

'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.

Upvotes: 45

Views: 102098

Answers (28)

sanjeev ch
sanjeev ch

Reputation: 31

npm install -g firebase-tools --force

$ firebase login

if you still got this 'firebase' is not recognized as an internal or external command, operable program or batch file

do this => npx firebase login

npx firebase init

Upvotes: 3

MrBom
MrBom

Reputation: 23

Using administrator cmd worked for me.

windows key

cmd

ctrl+shift+enter

npm install -g firebase-tools

Upvotes: 0

Basith P
Basith P

Reputation: 47

Try restarting your system. That worked for me

Upvotes: -1

Bianca Hendy
Bianca Hendy

Reputation: 1

In my case it was necessary to add npm path C:\Users<username>\AppData\Roaming\npm in environment variables in system PATH variable

Upvotes: 0

umermon
umermon

Reputation: 21

My firebase command stopped working after I uninstalled node and shifted to last version of node with nvm.

what worked for me is adding C:\Program Files (x86)\Nodist\bin to system environment variables

To do so here are the instructions:

  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. Add ;C:\Program Files (x86)\Nodist\bin; to the end of the list
  7. Then click "OK"
  8. In the "Edit environment variable" dialog click "OK".
  9. In the "Environment Variables" dialog click on "OK".

Upvotes: 2

liquardo
liquardo

Reputation: 103

I was struggling with this same issue for a few days and had an issue where my NPM was installed in two different places for whatever reason.

I had an npm folder in C:\Users\<user>\AppData\Roaming\npm\ as well as C:\Users\<user>\npm\

Turns out the Firebase installation command installed all the needed files into the latter folder, while my Environment PATH was pointing to the first folder.

I changed my PATH variable to C:\Users\<user>\npm\ and ran the firebase installation again. After that everything started working fine.

If you havent checked the other answers about what PATH is, you can access it by typing env in the Windows search bar and from there click the Environment Variables button. Then double click the Path line under System variables to edit it. Remember to press OK to save any changes.

This is probably a rare edgecase, but maybe it will help someone.

Upvotes: 2

Rin
Rin

Reputation: 1

If you have similar problems like this

firebase : File C:\Users\<user-name>\AppData\Roaming\npm\firebase.ps1 cannot be loaded because running scripts is disabled on this system. For more em. For more
information, see about_Execution_Policies at https:/go.microsoft.com/fwlink/?LinkID=135170.
At line:1 char:1
+ firebase login
+ ~~~~~~~~
    + CategoryInfo          : SecurityError: (:) [], PSSecurityException
    + FullyQualifiedErrorId : UnauthorizedAccess

perhaps you can try to Ctrl + Click the C:\Users<user-name>\AppData\Roaming\npm\firebase.ps1

After that you'll see a new PowerShell Terminal and you can continue it.

Hope it's works

Upvotes: 0

technik
technik

Reputation: 1076

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".

Upvotes: 20

Snehal singh
Snehal singh

Reputation: 49

npx firebase <your command>

Upvotes: -1

user13595542
user13595542

Reputation: 1

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

Upvotes: 0

Saud Ahmed
Saud Ahmed

Reputation: 65

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.

Upvotes: 1

Vladimir S.
Vladimir S.

Reputation: 31

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

Upvotes: 3

Fortun
Fortun

Reputation: 67

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"

Upvotes: 3

Pratyush
Pratyush

Reputation: 31

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.

Upvotes: 3

Shubham Tomar
Shubham Tomar

Reputation: 1

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

Upvotes: 0

Skull
Skull

Reputation: 11

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

Upvotes: -1

avraham calev
avraham calev

Reputation: 1

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

Upvotes: 0

Yassir Khaldi
Yassir Khaldi

Reputation: 1762

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

Upvotes: 0

Alalade Samuel
Alalade Samuel

Reputation: 672

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

Upvotes: 4

FreeZKnow
FreeZKnow

Reputation: 1

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

Upvotes: 0

Ajay jangid
Ajay jangid

Reputation: 973

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

Upvotes: 0

HamzaZaheer
HamzaZaheer

Reputation: 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.

Upvotes: 1

Tharindu Jayasinghe
Tharindu Jayasinghe

Reputation: 3181

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.

Upvotes: 1

Anurag Gorkar
Anurag Gorkar

Reputation: 41

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.

Upvotes: 4

S.Anu
S.Anu

Reputation: 431

npm install -g firebase-tools -f

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

Upvotes: 42

Gabe
Gabe

Reputation: 6875

Make sure you are running command line as an administer.

Upvotes: 1

Ali Bayram
Ali Bayram

Reputation: 7931

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

npm install -g firebase-tools

this worked for me

Upvotes: 12

KAPIL SHARMA
KAPIL SHARMA

Reputation: 477

Ok. First of all, Bizarre problem has some bizarre solution. Uninstall your node js and NPM completely. Then reinstall it, and check, whether it works or not. Best of Luck

Upvotes: 32

Related Questions