The term 'flutterfire' is not recognized as the name of a cmdlet, function, script file, or operable program - firebase

I'm trying to install flutterfire_cli in my root project, so I typed this command:
FirebaseFirestore firestore = FirebaseFirestore.instance;
so after that, this is the output of my console:
PS C:\Users\PC\Desktop\eventually> dart pub global activate flutterfire_cli
Package flutterfire_cli is currently active at version 0.1.1+2.
Resolving dependencies...
The package flutterfire_cli is already activated at newest available version.
To recompile executables, first run `global deactivate flutterfire_cli`.
Installed executable flutterfire.
Warning: Pub installs executables into C:\Users\PC\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
A web search for "configure windows path" will show you how.
Activated flutterfire_cli 0.1.1+2.
To fix the warning I added C:\Users\PC\AppData\Local\Pub\Cache\bin to my Path in system variables environnement. (but it does not work, I'm still getting the warning)
Next, I'm trying to generate the firebase_options.dart file as the documentation says using this command:
flutterfire configure
But I'm getting an error in the console:
PS C:\Users\PC\Desktop\eventually> flutterfire configure
flutterfire : The term 'flutterfire' is not recognized as the name of a cmdlet, function, script file, or operable
program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ flutterfire configure
+ ~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (flutterfire:String) [], CommandNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
Could anyone tell me what I am missing, why I am getting this error even if the Firebase CLI already installed on my machine?

Go through this doc very carefully: https://firebase.flutter.dev/docs/cli/
Step 1: Install Firebase CLI
Step 2: Install FlutterFire CLI with this command dart pub global activate flutterfire_cli
While doing this you must notice the following warning
Warning: Pub installs executables into C:\Users\PC\AppData\Local\Pub\Cache\bin, which is not on your path. You can fix that by adding that directory to your system's "Path" environment variable. A web search for "configure windows path" will show you how.
This means you need to add C:\Users\*username*\AppData\Local\Pub\Cache\bin into your System's environment path.
Step 3: Now flutterfire configure should work.
If still not working play with Firebase commands

For Mac -> Execute this command:
export PATH="$PATH":"$HOME/.pub-cache/bin"

Three 3 steps for getting it work on Windows:
Run this command:
dart pub global activate flutterfire_cli
Type env into Windows search and open Edit the system environment variables --> Environment variables --> System variables( the one on the bottom of the window) --> Double click on Path --> New and enter this:
C:\Users\PutHereYourUsername\AppData\Local\Pub\Cache\bin
flutterfire configure command should work now - close and open again command prompt or other terminal. Sometimes there is a problem with other editors and terminals where flutterfire configure still does not work. In that case open Command Prompt and it works there for sure.

As for me, I have done everything correctly and the command works if I run in the Windows command prompt, but it fails to work if I type the command inside the VS code terminal.
So I just killed the terminal and opened it again, then it works.
Or, you can try restarting your machine.

Even after adding C:\Users\PC\AppData\Local\Pub\Cache\bin to the path for me flutterfire would not work from the command line, the reason being that it actually instally a flutterfire.bat file.
So I use flutterfire.bat in the command line as of now and that is working.

For Linux/Ubuntu run this command in the terminal,
export PATH="$PATH":"$HOME/.pub-cache/bin"
Which you will also notice in the terminal when you run the command ↓.
dart pub global activate flutterfire_cli

Make sure you are your project directory
run this export PATH="$PATH":"$HOME/.pub-cache/bin"

For Linux/Ubuntu you should do the following:
Open your .bashrc file using the command "sudo nano ~/.bashrc"
Add export PATH="$PATH":"$HOME/.pub-cache/bin" to the end of the file.
Final you can source the file using "source ~/.bashrc"
It should now be able to recognize the file.

for macOS Monterey edit ~/.zprofile instead .zshrc

This was the hack i used to solve mine. I copied and pasted the C:\Users\PC\AppData\Local\Pub\Cache\bin in my folder search bar to enter the folder, note I could not find any folder called AppData, but when I pasted it on the folder search it did take me to the bin folder.
In the bin folder, you will find a file called flutterfire.bat. Copy and paste the flutterfire.bat file in the root of your project and then run the .\flutterfire configure command. Please do note the dot (.) and forward-slash (\). You need to add it to work.

for mac m1 , add
export PATH="$PATH":"$HOME/.pub-cache/bin" at the top of users/username/.profile , works on (monterey)

For me, even after I installed everything correctly, restarting my IDE(VSCode) did the trick.

Flutter command not found
Here is very easy instructions for adding something to your path on Mac, It solved my issues with Flutter and Flutterfire.

The export PATH="$PATH":"$HOME/.pub-cache/bin" did not work on my Debian machine!
I removed the first line #!/usr/bin/env sh from $HOME/.pub-cache/bin/flutterfire file and the flutterfire command worked properly.

Use command prompt.. not the vsc terminal

if you followed the right answer and still not working, you need to restart your computer

Related

karaf: JAVA_HOME is not valid: /usr/lib/jvm/java-11-openjdk-amd64/bin/java [duplicate]

I am working in Ubuntu 16.04. I need to install gradle and the gradle is installed when i checked with sudo apt list --installed command but when i use gradle -version command it shows the following error,
JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-8-oracle/jre/bin/java
In sudo vim /etc/environment file,
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/"
http_proxy="http://username:password#IP:port no/"
https_proxy="https://IP:port no/"
ftp_proxy="ftp://IP:port no/"
I don't know where i made mistakes. Please help me.
Thanks.
On a 64bit openSuse 64 42.1 box;
readlink -f $(which java)
provided;
/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0/jre/bin/java
But;
export JAVA_HOME=/usr/lib64/jvm/jre-1.8.0-openjdk
is the path that worked and allowed java emulator to run.
So i think we have to manually browse our file system and see what path to choose.
Today I faced this problem. I am using the default java that comes with your linux distro (so in my case, linux mint).
$ whereis java
This command gave me
java: /usr/bin/java /usr/share/java
So, I opened /user/bin. There was a link to Java. I right clicked it and selected follow original link. This lead me to /usr/lib/jvm/java-11-openjdk-amd64/bin/java.
So now that I know where this java is, I opened my .bashrc file, and edited the JAVA_HOME.
So for my case,
## My Custom variables
export JAVA_HOME=/usr/lib/jvm/java-11-openjdk-amd64
export PATH=$JAVA_HOME/bin:$PATH
This solved the problem.
Now if you are using some other java (say you downloaded from oracle and extracted the zip file ...), then you have to add that location. So for example, if your java is in /home/user/.sdkman/candidates/java/current, then
export JAVA_HOME=/home/user/.sdkman/candidates/java/current
export PATH=$JAVA_HOME/bin:$PATH
I see a mismatch. In your enviornment file the JAVA_HOME is set to "/usr/lib/jvm/java-8-openjdk-amd64/" and your mentioned that the error that you got relates to the JAVA_HOME as "/usr/lib/jvm/java-8-oracle/jre/bin/java"
If you JAVA is really installed in /usr/lib/jvm/java-8-oracle directory, then you need to ensure that the JAVA_HOME is set to that directory. And also your PATH reflects $JAVA_HOME/bin in it.
I typically install Oracle JDK/JRE separately in a separate directory such as /usr/local/jdk1.8.0 etc.
check the jvm installtion folder from Files
eg : /usr/lib/jvm/java-12-oracle
then in terminal run sudo nano /etc/environment and add the line
JAVA_HOME="/usr/lib/jvm/java-12-oracle"
Then open terminal and run
export JAVA_HOME="/usr/lib/jvm/java-12-oracle"

'flutterfire configure' command not working, I need to set firebase in my flutter project

I followed "https://firebase.flutter.dev/docs/overview" instruction to set firebase in my flutter project.
step i took:
"flutter pub add firebase_core" then dependencies were added, and generated_plugin_registrant.dart was created.
generated_plugin_registrant.dart file
2) "dart pub global activate flutterfire_cli" it showed an warnign message ie "Warning: Pub installs executables into C:\Users\Asus\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
A web search for "configure windows path" will show you how.
Activated flutterfire_cli 0.1.1+2."
then i added "C:\Users\Asus\AppData\Local\Pub\Cache\bin" in system; "path" environment variable.
"flutterfire configure" now it gives error "bash: flutterfire: command not found".
Step by step commands for getting flutterfire work in Mac:
dart pub global activate flutterfire_cli
export PATH="$PATH":"$HOME/.pub-cache/bin"
curl -sL https://firebase.tools | bash
firebase login
flutterfire configure
More details here
Windows Step-by-Step guide:
Open the Windows Search Bar, type in “env”, and choose “Edit the system environment variables”
Click the “Environment Variables…”
In System Variables box, search for "PATH" and double click on it
Click "New" and then paste the following line, replacing *USERNAME* with your Windows username
C:\Users\*USERNAME*\AppData\Local\Pub\Cache\bin
Click Ok and restart your IDE, then try flutterfire commands
I had the same problem. Following command worked for me (in Windows).
flutterfire.bat configure
I had same problem and I solved this by:
Added C:\Users\<username>\AppData\Local\Pub\Cache\bin to Environment Path.
Restarted IDE
Executed command: dart pub global activate flutterfire_cli
Here's a solution that worked for me:
From your terminal,open your bash profile in your home directory. Example home directory, Users/your-name/. I'm using macOS, so I typed typed the command sudo vim ~/.bash_profile from my home directory folder, followed by E to edit.
Scroll to the bottom of the file or below # Flutter ENV, on your keyboard, hit i to insert, then paste the following line, export PATH="$PATH":"$HOME/.pub-cache/bin". Press ESC, type ":wq!" then press Enter to save the changes and exit vim.
From the command line, reload your bash profile with source ~/.bash_profile. flutterfire configure should now work.
Hrishabh
This worked for me.
Close your IDE.
Restart IDE.
Re-run "flutter pub add firebase_core" in your terminal.
Finally run "dart pub global acttivate flutterfire_cli" in your terminal.
I had the same problem here is the way to solve it:
Warning: Pub installs executables into C:\Users\userName\AppData\Local\Pub\Cache\bin, which is not on your path.
You can fix that by adding that directory to your system's "Path" environment variable.
Go the Windows searchbar and write var
Select modify system environment
Click on environment variables
On system variables click on Path
Click on Edit
On the modify the environment variable windows click on New
Copy paste C:\Users\userName\AppData\Local\Pub\Cache\bin
Close all the windows clicking on Ok
Restart Android Studio
Inside Android Studio terminal write this to check if succeed
dart pub global activate flutterfire_cli
You should have the following message:
The package flutterfire_cli is already activated at newest available version.
On windows, from flutter root folder, running 'flutterfire configure' I got the same error message.
The 'problem' was resolved when I removed the following lines from pubspec.yaml.
plugin:
platforms:
ios:
pluginClass: AppDelegate
(I added those lines in an attempt to create a "podfile" that is required in order to create a binary ios file. )
For me it required a little bit more work but this is what worked for me, I'm using Windows:
As mentioned already before I ran these steps:
1). Search for "Edit System Environment Variables"
2). Click on Environment Variables
3). Under System Variables, double click on "path."
4). Click on "New" and add C:\Users\USERNAME\AppData\Local\Pub\Cache\bin
5). Click OK and restart IDE
After restarting IDE I ran the following commands in the terminal and this time it worked
1). Firstly, flutter upgrade firebase_core
2). Then, I ran dart pub global activate flutterfire_cli again and this time when I ran flutterfire commands it worked.
For me it wasn't working in bash. When i switched over to the standard windows comand prompt it worked.

Firebase not recognized

I'm trying to host my static website on Firebase. But even after installing firebase packages using this cmd- (npm install -g firebase-tools)
when I try to run the command `firebase login then it shows me this error
{firebase : The term 'firebase' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if
a path was included, verify that the path is correct and try again. }
I have installed many times firebase package but error still there. Sharing snapshot for better illustration.
Any help would be appreciated...thanks in advance. imgage here link of error image
Open your terminal and type npm ls -g --depth=0
Copy the path, mine is C:\usr\local
Close your terminal
Add the path to PATH in user environment variables
Reopen your terminal
Type cd /
Type cd usr\local (Assume you are you using my path)
Finally, Type firebase.cmd login
If you are still confused, check this YouTube video: https://www.youtube.com/watch?v=sFrfhJXd_EE

How do you activate a venv in atom?

I'm new to all of this and I've been following tutorials the best I can, I wanted to try my hand at web app development but I'm clearly doing something or missing something.
I ran pip install Django in my Atom terminal, it said the installation was successful but threw a warning about my install file not being part of the PATH, even though that file is in fact on PATH but I believe I fixed that issue.
I then tried to follow a Django tutorial which told me to pip install venv, I couldn't get that to function but I did find the virtual environment package on Atom atom-python-virtualenv and installed it.
its there in my drop down package menu but when I click make and enter a name nothing happens.
I have been trying repeatedly to figure out how to activate a virtual environment in my atom terminal since last night and nothing seems to work! I tried the same commands in my windows powershell and they worked perfectly fine, so I went back to Atom and within that powershell tried again and the first couple things worked but I still ended up with an error which I'll copy/paste below;
PS C:\Users\Amelia\Documents\Atom Projects\microblog> cd env:
PS Env:\> ls virtual_env
ls : Cannot find path 'virtual_env' because it does not exist.
At line:1 char:1
+ ls virtual_env
+ ~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (virtual_env:String) [Get-ChildItem], ItemN
otFoundException
+ FullyQualifiedErrorId : PathNotFound,Microsoft.PowerShell.Commands.GetChildItemComm
and
PS Env:\> cd c:
PS C:\Users\Amelia\Documents\Atom Projects\microblog> .\venv\Scripts\activate
.\venv\Scripts\activate : The term '.\venv\Scripts\activate' is not recognized as the
name of a cmdlet, function, script file, or operable program. Check the spelling of the
name, or if a path was included, verify that the path is correct and try again.
At line:1 char:1
+ .\venv\Scripts\activate
+ ~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : ObjectNotFound: (.\venv\Scripts\activate:String) [], Comman
dNotFoundException
+ FullyQualifiedErrorId : CommandNotFoundException
I have no idea what i'm doing wrong here, the venv files are there in my script file if I look but nothing I do seems to allow them to be activated.
All I want to do is learn how to do this stuff and I can't get it to work. This is the first issue I've run into so far and I'm at a total loss as to how I might fix this.
is venv just completely incompatible with Atom??
I'm running Windows 10 if that helps in anyway.
My friend, first of all you have to select a specific folder for your project in a certain way in your system.
Then create a virtualenv via cmd on that path..
Now I'm activating my virtualenv via cmd
Now I'm inside my Virtualenv, I can log in if Atom is installed on my system
Now in the Atom software, at the bottom left of the screen, press noVirtualenv.
A window opens where your Virtualenv name is displayed, and you can select it by tapping on it.
Now your Virtualenv is ready and you can create or import your own project and get started.
You can activate virtual environments from the command line by typing
mypthon\Scripts\activate
where mypython is the name you gave to your virtual environment. This assumes the Atom extension correctly created the virtual environment.

Meteor command not found

I installed the same version from Official Windows Meteor Support on one computer and the command "meteor" runs normally, now I tried to install in another computer but is giving me the issue that the "meteor command was not found". I tried to add the path to the system variables, but it doesn't seem to work.
Any ideas? Thank you
I have just discovered in Windows (I am using Windows 8.1) that you have to type meteor.bat to invoke meteor. e.g. meteor.bat create myapp
The answers already listed were only half the answer for me.
The following steps, resolved the issue.
Set the SYSTEM Environment Variable to:
C:\Users\%username%\AppData\Local\.meteor
Or if you prefer, change to your username explicitly
C:\Users\rich\AppData\Local\.meteor
Then as per the accepted answer on this question.
Create a file named meteor in the directory where the meteor.bat is. E.g. the path above.
Hint, you can use
touch meteor
Copy these lines into the file and save
#!/bin/sh
cmd //c "$0.bat" "$#"
For others that might come across this issue.
I'm on Windows 10 and installed Meteor 1.4. Was getting meteor command not found when trying to run meteor from command prompt.
I checked my users PATH variables and found this entry:
C:\Users\%username%\AppData\Local\.meteor\
I removed the last backslash, saved the PATH variables, and then opened a new command prompt. The meteor command was now recognized.
My PATH variable entry now looks like this with the last backslash removed:
C:\Users\%username%\AppData\Local\.meteor
Note: You can replace %username% with your actual windows username. The entry should work fine as the system will resolve it to your username.
If path variable is not present in environment variables,
You can execute the command only from the directory where meteor is present. i.e., "C:\Users\username\AppData\Local.meteor\" directory.
To use the meteor from any directory inside the command prompt,
Add path variable to the environment settings.
"C:\Users\username\AppData\Local.meteor\meteor.bat".
Restart command prompt if already open.
This will enable meteor command to work everywhere.
The question is old but it might help others who face similar issue.
I just installed meteor and had the same issue. It looks like it installed successfully and added C:\Users\USERNAME\AppData\Local.meteor to the User variable (not system variable).
I am using Windows 10 and I might have to re-login or reboot for that to start working properly.
So, to use without re-login or reboot, use complete path in the directory where you want to create the project:
C:\Projects> C:\Users\USERNAME\AppData\Local.meteor\meteor my_project
Hope it helps.
Using the Node Command prompt instead of Terminal worked for me. Search for Node Command Prompt in the Start Menu.
On Linux,
If the problem comes from systemd service (systemclt) configuration, the PATH is not recognized properly, then:
Here is the error log:
Feb 3 00:13:43 localhost metassa-org[65870]: > meteor run --port=9999
Feb 3 00:13:43 localhost metassa-org[65881]: sh: 1: meteor: not found
Feb 3 00:13:43 localhost metassa-org[65870]: npm ERR! code 127
Feb 3 00:13:43 localhost metassa-org[65870]: npm ERR! path /var/www/domain.org/meteor/simple-todos-react
Feb 3 00:13:43 localhost metassa-org[65870]: npm ERR! command failed
Edit your service configuration file:
Environment="PATH=/home/ubuntu/.npm-global/bin:/home/ubuntu/.meteor:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:$PATH"
Replace /home/ubuntu with your user folder containing meteor install.
You may replace all with your current $PATH value instead.
ExecStart=/usr/bin/npm run start --prefix /var/www/meteor/simple-todos-react
Modify /var/www/meteor/simple-todos-react with your meteor project
Finally, restart your service.
sudo systemctl daemon-reload

Resources