'very_good' is not recognized as an internal or external command, operable program or batch file - flutter

I tried to activate very_good_cli in flutter with this command:
dart pub global activate very_good_cli
and result was this:
...
...
...
Building package executables...
Built very_good_cli:very_good.
Installed executable very_good.
Warning: Pub installs executables into ~\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 very_good_cli 0.7.2.
I also added ~\AppData\Local\Pub\Cache\bin to system Path, but this warning still persists and the error I get is:
'very_good' is not recognized as an internal or external command,
operable program or batch file
how can I solve this?

I just wanted to quickly put this together to make it obvious.
After running...
dart pub global activate very_good_cli
very_good.bat is added to your ~\AppData\Local\Pub\Cache\bin directory. So, you need your command-line shell to pick up on this change.
As mentioned above, if you run dart pub global activate very_good_cli a second time it will give you some good info in the form of a warning
Warning: Pub installs executables into `~\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 very_good_cli 0.7.2.
So, if the warning states the ~\AppData\Local\Pub\Cache\bin is not in your path, you need to add it there. Something like this. This essentially allows your command-shell to recognize 'very_good' as a command.
Link to video showing the process of adding to path
Once you are done with that, you need your command-line shell(s) to pick up the change. Easiest way to do that is to close them completely and reopen them. A tricky situation you might run into is if you are using a shell inside of another process. I use powershell terminal in vscode. So, I had to close vscode to actually refresh the terminal.
Restarting your computer is the nuclear button that should get the issue resolved if your Environment Variables are setup correctly or if there isn't some other wonky issue with the shell you are using. Using the built in windows cmd is a good test to see if it is just a problem with your preferred shell.

So after running dart pub global activate very_good_cli and adding path to ...\Pub\Cache\bin to the Path in system environment variables, restarting the windows solved the issue.

Related

Navigate to folder directly before i can use command in in a command line

I don't know how to search for my problem here.
In the command line i must navigate everytime directly in the folder where the software was installed.
Before I can use the command "java -v" or "flutter doctor" or what ever i must navigate to the java or flutter folder and i don't know why.
Maybe someone of you knows the ONE solution.
I use windows 11. I think it might be due to the environment variables - the environment variables entered are automatically deleted all the time.

I'm trying to use "flutterfire configure" but I'm getting an error. Can somebody have an issue for me please? [duplicate]

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

Flutter install in windows environment variable

I have problem when trying to install the flutter in my desktop first I get error of :
is not recognized as an internal or external command operable program or batch file.
Then I open the system environment variable and add the flutter to the user variables path plus I add all of the flutter, git, system32 to systems variables path section.
Unfortunately, the problem is still present even with a restart.
Now when I type flutter doctor to Command prompt No results are shown and I cannot write an extra line.
Welcome to stackoverflow!
You should take these steps:
Open RUN by shortcut (WINDOWS_KEY+R_KEY)
Type in RUN SystemPropertiesAdvanced.
System Properties dialog should appear, click Environment Variables.
In User variables (The Top section) select Path and click Edit.
Add the new path to flutter Binary folder like this C:\flutter\bin.
Select OK, and OK again in Environment Variables, and OK in System Properties.
Close any Command prompt you using and reboot the system.
Hooray, :D now flutter is successfully installed.

'flutter' is not recognized in windows cmd prompt with elevated permissions

Flutter path is correct but still unable to be recognized by the windows command prompt. Looked everywhere asked anyone who used flutter still unable to figure out the problem.
Tried suggestions made on other questions similar to this still no luck and followed the tutorials on installing flutter did not work.
For Windows users (Windows 10)
Open Start menu and type env
Click on Environment Variables..
under User variables, select Path then click Edit
Click New then past this line C:\src\flutter\bin(supposing this is where 'bin' directory of Flutter is located on your machine)
Click 'OK'.
Restart is required to apply changes.
The command prompt you're using appears to be using elevated permissions and therefore will have the "system" environment variables but not your user ones necessarily. Try with a non-elevated command prompt... which you should be using anyways. Only use an elevated command prompt when absolutely needed as otherwise you could delete important things by accident. Also, you can run echo %PATH% to see what is actually in the path in the command prompt you're using.
If you want to use flutter across multiple users or need to use an elevated command prompt for some reason, add the path to flutter/bin to the system environment variables instead.
Adding the following things in the path solved the issue for me
C:\Program Files\Git\bin
C:\Program Files\Git\cmd
C:\Windows\System32
C:\Windows\SysWOW64\WindowsPowerShell\v1.0
C:\src\flutter\bin
For windows user make sure to include C:\Windows\System32 in your user PATH variable,this prevents the flutter command prompt from flashing when you click it.

PhoneGap command not recognized

I have followed the directions on PhoneGap's website and installed PhoneGap using the command prompt on Windows. However, after it has installed I try to run the command 'phonegap' and I get an error saying that 'phonegap' is not recognized as an internal or external command, operable program or batch file. How do I fix this? Thanks.
You might need to add phonegap to your classpath variable, in order to let the prompt know where the phonegap .exe file is located.
Try writing the full path of the exe file, if that runs, then what I mentioned above should solve your problem.
EDIT
Just looked at the install page at phonegap.com (http://phonegap.com/install/). Very scarce on the information I would say.. But I still recommend investigating the above.
The Problem with enthronement variable for default path of your your current user. Follow the steps.
Click the Start menu and type "regedit" on the search box. This will launch the Windows Registry Editor program.
Enter to the following Registry entry: HKEY_CURRENT_USER\Software\Microsoft\Windows Script Host\Settings
Select the "Enabled" entry in the right side window. If this entry is there, right-click and select "New" followed by "DWORD Value." Name the value "Enabled."
Right-click the "Enabled" entry and click "Modify."
Change the number in the "Value" box to "1." This will re-enable WSH.
close all opened cmd windows and open a new window.
Just try to run CMD as administrator. Hopefully that will solve your problem. This solved mine.
Even though this is a very old question, I'm going to post a solution that worked for me on Windows Vista/7/8. The problem is that by default the command prompt in which the npm command is run is not elevated. So launch a command prompt as administrator and then run npm command. If it is not elevated then the environment variables wont be set properly.
In windows 7 platform, when the latest version of phonegap (3.4) installed it hosts in path like this:
C:\Users\\AppData\Roaming\npm
Sometimes you should add this address to the PATH environment manually.
Go to System Properties-> Advanced -> Environment Variables
Select PATH variable from list and then edit it