Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't access firebase command after install #46

Closed
alexsandracodes opened this issue Apr 13, 2015 · 48 comments
Closed

Can't access firebase command after install #46

alexsandracodes opened this issue Apr 13, 2015 · 48 comments
Assignees

Comments

@alexsandracodes
Copy link

I'm able to run the global install of firebase-tools:
$npm install -g firebase-tools
but then I try to run:
$ firebase init
and I get the error:

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

I would really appreciate anyone's help! I've also posted this on stackoverflow:
http://stackoverflow.com/q/29531235/4342441?stw=2

@robertdimarco
Copy link
Contributor

@alexsandracodes Apologies for the delayed reply. What can you tell us about the platform that you're running on (Win, OSX, Linux w/ version) in addition to the environment (Node and NPM versions)?

@robertdimarco robertdimarco self-assigned this Apr 28, 2015
@robertdimarco
Copy link
Contributor

@alexsandracodes From the StackOverflow, it looks like you're on Windows. If you've solved this, could you let us know how you resolved it? If not, could you reach out to me at rob@firebase.com?

@alexsandracodes
Copy link
Author

Hey Robert! Thanks a lot for the response. Sorry I didn't notice it before. It wasn't actually an issue with firebase, it was an npm install issue. I got it figured out now. :)

@robertdimarco
Copy link
Contributor

@alexsandracodes Ok, great! I'll close this issue out. Out of curiosity, is there anything that might be useful for us to document, in case others run into the issue?

@alexsandracodes
Copy link
Author

Yeah, definitely. I'm glad you ask. From my perspective, Firebase is a great tool for those who are not shy to pick up programming, but who are not necessarily knowledgeable of all the ins-and-outs. I've basically described myself, someone who wants a robust and easy to use tool that they can use without having to learn back-end programming in-depth. I feel like that aligns with Firebase's vision. That being said...

I like the clear and concise format of the guides, but there are cases where things are too simplified, and they don't actually work out for the user as simply as shown in the guide. Take for example, the hosting/deploy guide on firebase (https://www.firebase.com/docs/hosting/guide/deploying.html). It quickly tells you to install node.js and then run '$ npm install -g firebase-tools', and then '$ firebase init'. In theory, this processes should have been very easy for me, but instead it took a lot of times, weeks, to figure out what was going on behind the scenes with node.js and it's npm installer. It would be helpful if you could reference some guides for node.js and npm installer so that readers who are not familiar with the software and look it up. Basically, what I'm trying to say is, for the newbie who is picking up web dev for the first time, giving them a bigger picture of what the dependencies are (other software requirements) and some of the issues that they might occur along the way, would be helpful.

Also, it would be great if there was an option to export your documentation as a PDF or even a basic text file. As I recall, documentation for Firebase documentation is only accessable via the web.

@robertdimarco
Copy link
Contributor

@alexsandracodes Thanks for the feedback! That's really helpful, and I'll pass this along to the rest of the team.

@ega123
Copy link

ega123 commented Aug 11, 2015

so how did you fix it @alexsandracodes ????? same prob ty.

robertdimarco pushed a commit that referenced this issue May 18, 2016
Switching out use of project for instance
@itshasnainkhanofficial
Copy link

kindly tell me how did you resolve this problem i have install npm tool but i could not understand what is npm issue

@tejasrsuthar
Copy link

Today I also got the same issue. @alexsandracodes would you please kindly let us know what steps did you follow in order to fix that issue? Thanks.

@developer--
Copy link

developer-- commented Aug 12, 2016

@flyingsriracha
Copy link

flyingsriracha commented Oct 12, 2016

@tejasrsuthar
navigate to the firebase directory and call it out on the cmd. so
1.run cmd as admin
2. cd C:\users\yourusername\AppData\Roaming\npm
3. firebase.cmd login
or firebase login
there you go. above steps are all commands goes to your command prompt.

@tejasrsuthar
Copy link

Thank you so much @flyingsriracha it worked.

@alexandlazaris
Copy link

Ahh this causes me so much pain! I had it working the very first time I installed firebase and ran login, deploy, etc.

After closing the PowerShell window I was using, I haven't been able to access firebase commands in any CLI (cmd, Git Bash, PowerShell or all as administrator). I have done the steps outlined by @flyingsriracha however it only gets me to 'login'. I can't do any other firebase commands in any other directory.

Please help! I've also installed latest firebase tools several times in each CLI with no luck (they install, I restarted and I still cannot access firebase commands). I am on Win 10.

Thanks!

@alexandlazaris
Copy link

And within 8 minutes of posting I did it! Albeit ... not as I expected.

To use firebase at the moment, I must list the FULL directory path with each command. Meaning "firebase init" is now "C:\Users\name\AppData\Roaming\npm\firebase.cmd init"

Now I just realised, that's what you said @flyingsriracha 💃

@eurolife
Copy link

like the above, I was only able to run it by typing the full path, ie; C:\Users\name\AppData\Roaming\npm\firebase init
Why is it like this when it is supposed to be easier by simply typing firebase init from within the project folder? And how can we fix things so that it is like this? Is that possible? Running Windows 7.

@danielcrowley
Copy link

danielcrowley commented May 31, 2017

SOLUTION
For those still having trouble, seems to be for me that where npm installs its packages has been lost as an environment variable.
If the package has been installed globally, it's normally in C:\Users\"yourname"\AppData\Roaming\npm
If you add that to your %PATH%, open a new cmd window, and you should be good to go.

@SaikCaskey
Copy link

Cheers @flyingsriracha those were exactly the steps I needed

@m1is
Copy link

m1is commented Dec 3, 2017

None of this works. What do you have to do to get this running? What a joke.

@vedhaperi
Copy link

This worked for me:

  1. Open cmd and cd C:\Program Files\nodejs
  2. npm install -g firebase-tools
  3. Restart your computer
  4. Open cmd and check firebase --version.

@Dashing-Daniel-Li
Copy link

Dashing-Daniel-Li commented Feb 10, 2018

in cmd to check if it is installed and its version:
npm firebase -version

@vuabid
Copy link

vuabid commented Mar 1, 2018

Add this path to Windows 10 Advance Settings "Environment Variables" PATH and then restart your system.
%USERPROFILE%\AppData\Roaming\npm\firebase;

@ghost
Copy link

ghost commented Mar 26, 2018

Try to reinstall NodeJS that fixed this problem for me

@dark-swordsman
Copy link

Building off of what @danielcrowley said, make sure you EDIT your Path variable. Put a comma at the end and then paste the path, otherwise, you'll do what I just did and delete whatever else was in your path and overwrite it with your new npm path.

Whoops :(

@Mosanwar
Copy link

Mosanwar commented Jul 4, 2018

@danielcrowley it still not working for me

@A002465056
Copy link

Thank you so much @flyingsriracha it worked.

@Gideon1007
Copy link

@vedhaperi thank you so much ..

@PercyPham
Copy link

PercyPham commented Jul 29, 2018

@vuabid has mentioned the way to fix the long path problem, but I will make it detail instruction for others:
(I'm using win 10)

  1. Open File Explorer (or simply press WindowButton + E).
  2. Right click on "This PC" => properties
  3. Look for "Advanced system settings" on the left side => click on that and it will open a popup
  4. Choose "Advanced" tab => Click on button "Environment Variables ..."
  5. In the "System variables" segment, look for variable "Path" => choose and click on "Edit" button
  6. Click "New" button and paste in the new line with this link:
    "C:\Users{yourUsername}\AppData\Roaming\npm"
    (Check the link in your PC for concise path)
    => Press Enter => OK => OK => OK
  7. Now you can open a new cmd, type in "firebase --version" and you will see the version of your firebase

@LyndonMcjohnson
Copy link

bless you! @PercyPham

@VijayReddyDudipala
Copy link

This alone worked for me on Windows 10 system
npm install -g firebase-tools
Before trying this I used :
npm i g firebase-tools (just g instead of -g) and it was not working

@elebitzero
Copy link

On Windows 10, Press Win+I to open the system settings dialog. In the search box type "environment" Choose "Edit Environment variables for your account"
Then add %USERPROFILE%\AppData\AppData\Roaming\npm to your Path environment variable.

@chunkingz
Copy link

I think the main issue most people have is that when you navigate to C:\Users\USERNAME\appdata\Roaming\npm
"firebase" file and "firebase.cmd" file tend to be missing. I believe a re-install and reboot should fix it

@cnscorpions
Copy link

add env variable in path can fix it. and restart cmd. if you use some terminal emulator like fluent terminal, it may not recognize, just have a try at another one, like hyper terminal, or cmd, powershell

@Soumya1698
Copy link

@danielcrowley Thanks. Adding a globally installed package to the path of env variables helps.

@jag-chichria
Copy link

C:\users\yourusername\AppData\Roaming\npm

Alternatively, you can add this to your PATH using environment variables in windows.

@hanuz06
Copy link

hanuz06 commented Sep 29, 2019

Add this path to Windows 10 Advance Settings "Environment Variables" PATH and then restart your system.
%USERPROFILE%\AppData\Roaming\npm\firebase;

Thank you very much. That worked for me.

@HassanAb0123
Copy link

This worked for me "npm install -g firebase-tools"

@JigneshGothadiya
Copy link

JigneshGothadiya commented Dec 3, 2019

Some time when you install node it will update %PATH% for user environment variable but you have to add "C:\Users\username\AppData\Roaming\npm" path in %PATH% of system environment variable and then after restart you terminal or cmd and try "firebase init".

@justingolden21
Copy link

justingolden21 commented Jan 6, 2020

I've tried changing the path variable, running from the npm directory, restarting, and everything else listed here. Still no luck.

It worked fine on another PC though.

@deepa-cv
Copy link

The "firebase login" command is not working for me.What do i do?

@markeu
Copy link

markeu commented Feb 11, 2020

likewise me, tried all the options stated here all to no avail

@harsh242
Copy link

I tried all the methods but I am still getting the same error.
firebase: command not found
Please help?

@sasuadrian
Copy link

For people who try all the methods and still getting the same error, the following steps works for me:

  1. run npm install -g firebase-tools
  2. In *C:* you will see a folder name usr. In the usr folder, copy the local folder and paste it in the C:\Users{PCName}\AppData\Roaming\npm.
  3. Rename the local with firebase.
  4. Enter in environment variables -> Path ->Edit -> New -> C:\Users{PCName}\AppData\Roaming\npm\firebase -> OK -> OK -> OK

And restart the PC

After restart, for testing if it work, enter in cmd and write firebase --version

@MuhammadFareed
Copy link

@tejasrsuthar
navigate to the firebase directory and call it out on the cmd. so
1.run cmd as admin
2. cd C:\users\yourusername\AppData\Roaming\npm
3. firebase.cmd login
or firebase login
there you go. above steps are all commands goes to your command prompt.

It is also not working!

@AnuragGorkar
Copy link

Thankyou @flyingsriracha that worked for me

@AssaultLemming
Copy link

I have this problem, tried all the above steps, have the correct environment variables and no luck.

I see that firebase is contained within /users/appdata/roaming/npm/node_modules/firebase

How far down the directory tree should the Path variable be set? only to /npm ?

@Ashirkhan961
Copy link

I'm able to run the global install of firebase-tools:
$npm install -g firebase-tools
but then I try to run:
$ firebase init
and I get the error:

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

I would really appreciate anyone's help! I've also posted this on stackoverflow:
http://stackoverflow.com/q/29531235/4342441?stw=2

This is the answer!!
Set-ExecutionPolicy RemoteSigned

@Ashirkhan961
Copy link

I have this problem, tried all the above steps, have the correct environment variables and no luck.

I see that firebase is contained within /users/appdata/roaming/npm/node_modules/firebase

How far down the directory tree should the Path variable be set? only to /npm ?

Hii!

Just Run this command in your working directory.
Set-ExecutionPolicy RemoteSigned

@katowulf
Copy link

katowulf commented Jul 24, 2020

There are now an abundance of troubleshooting steps and solutions offered here. Locking this issue as further "me too" discussions aren't going to be findable or resolvable at this point. If you try the following steps and still have problems, file a separate issue with a minimal, complete, verifiable repro of the problem (logs, screenshots, steps, version info, os info, et al) that can be used for troubleshooting.

Ways to install the CLI (doc):
auto install script: curl -sL https://firebase.tools | bash
standalone binary: download here
npm version: npm install -g firebase-tools

Where the CLI executable is usually stored
Mac: /users/appdata/roaming/npm/node_modules/firebase
Windows: C:\users\yourusername\AppData\Roaming\npm or %USERPROFILE%\AppData\AppData\Roaming\npm

Potential solutions if your OS can't find the command

  1. If running env (mac) or echo %PATH% (windows) doesn't show the path to your CLI executable add it to your PATH environment variable (on windows: WIN+L to open settings, search for environment).

  2. Try running Set-ExecutionPolicy RemoteSigned so post

  3. Run it manually (just a temporary workaround, should not be necessary)

    1. run cmd as admin
    2. cd C:\users\yourusername\AppData\Roaming\npm
    3. firebase.cmd login or firebase login

After all solutions, you need to close the terminal / command prompt and restart it! Some users had to restart their computers before the changes took effect, but it's unclear if that's actually necessary.

@firebase firebase locked as resolved and limited conversation to collaborators Jul 24, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests