maaoui karim
maaoui karim

Reputation: 679

flutter doctor doesn't work on neither Command Prompt or PowerShell window?

flutter doctor doesn't work on either Command Prompt or PowerShell window? I have been trying to install flutter on windows. I have cloned the Flutter SDK as mentioned in the tutorial. I have added git and the flutter to my path. But still when I try to run the flutter doctor the command prompt reply with this:

'where' is not recognized as an internal or external command operable program or batch file.
Error: Unable to find git in your path

enter image description here

check the cmd image you will see exactly the problem

Upvotes: 66

Views: 191876

Answers (21)

Mahesh Jamdade
Mahesh Jamdade

Reputation: 20221

To run flutter from the command prompt on your windows system, it requires three things

  1. path to the bin folder of downloaded flutter sdk I have downloaded and saved the sdk in my documents so for me path will be

C:\Users\mahesh_2\Documents\flutter_windows_v0.11.9-beta\flutter\bin

  1. where.exe located at C:\Windows\System32

Note:you need to download git from here if you dont find path in step 3

  1. git-cmd.exe located in C:\Program Files\Git\git-cmd.exe

so to simply add these three paths to your environment variables go to system environment variables with variable name as Path

and value as

C:\Windows\System32;C:\Program Files\Git\git-cmd.exe;C:\Users\mahesh_2\Documents\flutter_windows_v0.11.9-beta\flutter\bin

enter image description here

restart the command prompt and try running flutter and Voila! you should get something like this

enter image description here

Upvotes: 42

jay mangukiya
jay mangukiya

Reputation: 11

In My case, I type command flutter pub get in terminal it works for me

Upvotes: 0

Daniel
Daniel

Reputation: 273

I also encountered that when I was installing flutter.

Add those to System variables (not user variables), besides flutter itself:

C:\Flutter\flutter_windows_2.2.1-stable\flutter\bin

make sure you have System32, Git and PowerShell

C:\Program Files\Git\cmd
C:\Program Files\Git\bin
C:\Windows\System32
C:\Windows\System32\WindowsPowerShell\v1.0

Flutter doctor will also complain about Java so make sure you install and add the java sdk to path as well:

C:\Program Files\Java\jdk-12.0.2\bin

The problem on my side was that PowerShell was missing from path.

Upvotes: 4

chk.buddi
chk.buddi

Reputation: 603

I tried setting absolute paths for 'System32' and 'PowerShell' but it didn't work. Finally, it was solved after setting the path as follows.

enter image description here

Upvotes: 0

kirkadev
kirkadev

Reputation: 348

It didn't work for me either. But when I installed what is written here, I rebooted my computer and everything worked for me. enter image description here

Upvotes: 1

Metaller
Metaller

Reputation: 514

Remove spaces before and after each path in your Environment Variables!

// incorrect value
C:\src\flutter\bin; C:\Program Files\Git\git-cmd.exe; C:\Windows\System32\

// correct value
C:\src\flutter\bin;C:\Program Files\Git\git-cmd.exe;C:\Windows\System32\

Upvotes: 2

Sumit Singh
Sumit Singh

Reputation: 1258

Simply check all the Environmental variables ... these are present in path Variable or not, in case of Flutter

C:\Windows\System32;
C:\Program Files\Git\cmd;
C:\Program Files\Java\jdk1.8.0_221\bin;
D:\flutter_windows_v1.7.8+hotfix.4-stable\flutter\bin\

System32 file is important for git. please check is it present or not.

Upvotes: 4

90Degree
90Degree

Reputation: 309

I really see a big mess here; however the solution is very simple. Even no restart needed.

To my case I saved the flutter folder in my account's source folder and I appended this value in the PATH entry;

%USERPROFILE%\source\flutter\bin

Note: I only had one value and it was for Microsoft WindowsApps (;

Explanation

Now, we all know that we need to append "the full path to flutter\bin" in the PATH entry or create a new one if it doesn't exist. However, Windows users have different profile folders thus our case for the full path. So to solve this common problem whatever was the typical path for the user's profile folder, we can use %USERPROFILE% value which is a Constant special item ID list (CSIDL). See Recognized Environment Variables

Constant special item ID list (CSIDL) values provide a way to identify folders that applications use frequently but may not have the same name or location on any given computer.

So if you saved the Flutter folder, like me, in the user's profile folder, Just copy %USERPROFILE% and paste it before the flutter's bin folder directory in the PATH entry and then append all to the existing values using ; as a separator or similarly click the New button on the right side of the panel and paste it.

Upvotes: 0

cuzox
cuzox

Reputation: 794

If it happened to you like it happened to me, you probably went to add flutter\bin to the environment variables by editing the Path system variable.

You then proceeded to press the Browse button, and selected your desired path.

The part you didn't expect was that it actually overwrote the %SYSTEMROOT%\System32 entry, which is the first path in the list, and the path which becomes highlighted by default when you open that edit window.

If this is the case for you, simply press the New button, and add %SYSTEMROOT%\System32 back into the Path variable, which should make where.exe available again.

The thing to note here is that the Browse button in the Path variables edit window, will overwrite the highlighted path with the newly selected path, so it is important to make sure none of the existing paths are highlighted when using it.

Upvotes: 0

Severin Klug
Severin Klug

Reputation: 754

There are two mistakes to be avoided:

  1. Add it to the System variables Path, not the user variables path

  2. In the Windows 10 Interface do not mistake the new variable for the solution to add your path to the Path-variable. In most cases there should alrady be a variable named Path (otherwise create one) which contains all paths and you have to append your path to flutter/bin to this Path-variable.

Upvotes: 6

VinniePaz
VinniePaz

Reputation: 39

I just removed the existing path and added a new one to make it work.

  1. Delete existing Path
  2. Create a new user variable named Path with the full path to flutter\bin as its value
  3. Set the three variable path:

    C:\Windows\System32;C:\Program Files\Git\git-cmd.exe;D:\flutter\flutter\bin

D:\flutter\flutter\bin should be replaced with the path to your drive (the placed where you extracted Flutter zip file

Close and reopen the console for these changes to take effect.

Upvotes: 3

anggadaz
anggadaz

Reputation: 390

I have same issue. (I already add env variable n works fine last week) the problem is my antivirus delete flutter.bat in flutter\bin.

i fix this, after redownload flutter.bat or redownload whole flutter.

Upvotes: 5

Alon Lavi
Alon Lavi

Reputation: 329

Just adding my two cents. I had same problem and after trying everything i read, i eventually just used "echo %path%" in the command line and saw that the path of flutter contains illegal character. After deleting flutter entry in PATH and typing it again manually instead of copying it, it is finally working. Just in case it can help someone.

enter image description here

Upvotes: 0

crushman
crushman

Reputation: 1112

If your like me and adding flutter to the user environment didnt work, you can actually run the command by replacing flutter with the path of your flutter.bat file like so : C:\fluttersdk\flutter\bin\flutter.bat doctor this works the same way if your running flutter build apk it will end up like this : C:\fluttersdk\flutter\bin\flutter.bat build apk as the command.

Upvotes: 2

Amit Kumar
Amit Kumar

Reputation: 1819

Solving above issue

Set the three variable path

  • First Flutter path (Mainly in c drive)

    C:\src\flutter\bin

  • Second GIT Path

    C:\Program Files\Git\cmd

  • Third System32 path

    C:\Windows\System32

Use Window command Prompt if you working with Window , Restart the command prompt it will work properly.

Run Command

flutter upgrade

Upvotes: 11

Rahul Sharma
Rahul Sharma

Reputation: 13593

I was also stuck in the same problem where I was running flutter command on Window default command prompt. Although I have already added the C:\src\flutter\bin path in User Environment Variables. The solution that works for me is to add C:\Windows\System32\ into the Path variable in User Environment Variables. Once you have done this restart your system and run flutter command on default Command Prompt.

Hope this will help you out.

Upvotes: 2

RoCkDevstack
RoCkDevstack

Reputation: 3817

If your working in Android Studio, you will find it on the

Tools -> Flutter -> Flutter Doctor

Running flutter doctor on the cmd is not recognizable as internal or external command.

Flutter

But on Android Studio Terminal, it run just fine.

flutter doctor


P.S - If you use Android Studio as your IDE, don't forget to install the Flutter Plugin and Dart Plugin.

Upvotes: 1

Alex Jean
Alex Jean

Reputation: 682

Had the same issue and solved it by making sure flutter PATH was added in the environment variables... within the system variables box when you "edit the system environment variables. Editing the upper-box called "user variables" did not solve the problem for me.

Upvotes: 7

T.Binyam
T.Binyam

Reputation: 213

First of all where.exe command is located inside C:windows\System32, so go to

  1. Edit the System Environment Setting
  2. Click Environment and edit,
  3. Then inside 'Path' add C:windows\System32 separated by ;
  4. Finally add C:\Program Files\Git\git-cmd.exe click OK

Now restart your cmd again.

Upvotes: 2

Exception
Exception

Reputation: 2323

I had the exact same issue, and by following the solution given here, I was able to resolve this.

The issue was C:\Windows\System32\ was missing from my PATH variable. So, to resolve it just follow the below steps:

  1. In Search, search for and then select: System (Control Panel)

  2. Click the Advanced system settings link.

  3. Click Environment Variables. In the section System Variables, find the PATH environment variable and select it. Click Edit.

  4. In the Edit System Variable window, add C:\Windows\System32 separated by a ;. Click OK. Close all remaining windows by clicking OK.

  5. Restart your computer.

Now run flutter doctor

Upvotes: 28

Nadun Kulatunge
Nadun Kulatunge

Reputation: 1731

1) Make sure that the environment variables are set correctly,

  • Go to “Control Panel > User Accounts > User Accounts > Change my environment variables”

  • Under “User variables” check if there is an entry called “Path”:

    • If the entry does exist, append the full path to flutter\bin using ; as a separator from existing values.

    • If the entry does not exist, create a new user variable named Path with the full path to flutter\bin as its value.

2) Reboot your computer

Once both above steps are done, run flutter doctor

Note: Run this command in either a Command Prompt or PowerShell window. Currently, Flutter does not support third-party shells like Git Bash. (Source: Flutter Documentation)

Upvotes: 35

Related Questions