Reputation:
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
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
Reputation: 23
Using administrator cmd worked for me.
windows key
cmd
ctrl+shift+enter
npm install -g firebase-tools
Upvotes: 0
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
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:
Upvotes: 2
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
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
Reputation: 1076
If you are using MS Windows:
c:\users\<yourusername>\AppData\Roaming\
dir and select the "npm" sub-dir, then click "OK".For the Linux users:
Upvotes: 20
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
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
Reputation: 31
My solution is to use Firebase CLI binary for Windows:
Upvotes: 3
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
Reputation: 31
After running npm install -g firebase-tools
, go to C:\usr\local
. You will see Firebase files.
C:\usr\local
to the clipboard.PATH
variable under the system environment variables (lower section).PATH
and click EditC:\user\local
to the beginning of the path.%APPDATA%\npm
if it doesn't exist.After this, open a Windows command prompt and run firebase --version
.
Upvotes: 3
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
Reputation: 11
https://github.com/firebase/firebase-tools/issues/46#issuecomment-615534999
C:\Windows\System32\cmd.exe
or type this in your file path and hit EnterUpvotes: -1
Reputation: 1
For anyone still fighting this problem try to add the system environment path not to a user's environment.
Upvotes: 0
Reputation: 1762
Add C:\users\yourusername\AppData\Roaming\npm
to your environment variable PATH.
Upvotes: 0
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
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
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
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
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
Reputation: 41
Navigate to the firebase directory and call it out on the cmd.
There you go. above steps are all commands goes to your command prompt.
Upvotes: 4
Reputation: 431
npm install -g firebase-tools -f
Using -f for force install again. This work for me
Upvotes: 42
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
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