Dealing with some significant frustration trying to set up my environment variables just to run Flutter. in my path, I've tried many suggestions to try setting up my Path route so that the Flutter Console (or cmd) can successfully run the command "flutter doctor" just to download all the packages, etc. But the problem is as soon as I run this command, it instantly closes my terminal. There isn't anything happening, the terminal just closes. Any help would be appreciated, and I've attached my screenshots of my Path envs to maybe help out some more. envs
16 Answers
I also get the same problem i.e whenever I hit the flutter doctor command; the terminal instantly closes. Solution : Add the following to the system variable path.
C:\Windows\System32\WindowsPowerShell\v1.0
everything will work fine

- 241
- 2
- 5
Add this to system variable PATH:
C:\Windows\System32\WindowsPowerShell\v1.0
Open cmd as admin and set variables:
setx /M FLUTTER_HOME "C:\flutter" <---- here folder where your flutter is
setx /M PATH "%FLUTTER_HOME%\bin;%PATH%"

- 18,379
- 16
- 47
- 61

- 481
- 5
- 3
I was facing the same issue and I resolved it: the problem was PowerShell version.
I am using Windows 8 and by default it has version 4.
Flutter needs version 5.0, so I upgraded my PowerShell.

- 2,917
- 23
- 46
- 68

- 41
- 6
Add PowerShell
path to your PATH in environment variables if not exists.
In my case C:\Windows\System32\WindowsPowerShell\v1.0
added to the PATH

- 1,424
- 17
- 26

- 51
- 2
-
What is `check power shell.` to mean? How does this improve on [SUDHANSHU SHARMA's Mar 22 answer](https://stackoverflow.com/a/66748445/3789665)? – greybeard Apr 05 '21 at 09:47
-
Power shell path in system variables – H.Z music Apr 06 '21 at 12:12
in my case non of the answers worked even adding C:\Windows\System32\WindowsPowerShell\v1.0
didn't fix the problem.
the only solution that worked for me is running the command or terminal as an administrator

- 1,393
- 1
- 13
- 34
I have tried many solutions from the article but all failed. After I
try this way it works
git config --global --add safe.directory C:/flutter. C:/flutter should be the directory of flutter that you use

- 45
- 6
Try this:
- Moved flutter from
C:/
drive toD:/
. - Update the environment variable of flutter.
- Reboot the machine.

- 629
- 2
- 7
- 20

- 11
- 1
Note: Flutter relies on a full installation of Android Studio to supply its Android platform dependencies. However, you can write your Flutter apps in a number of editors; a later step discusses that.
(https://flutter.dev/docs/get-started/install/windows) You could try to install android studio on your machine and try again.

- 1
- 1
Download Flutter SDK again and change your Flutter SDK path and update new path in environment variable and restart your IDE
The problem is of powershell only. In my case I mistakenly used ; at the end of path which was creating problem.

- 1
- 1
Perhaps it's like when you run a bat file and Windows closes it because there's no pause command at the end?
When I ran a bat file with the same command from sublime, i saw that it said this in sublime's output...
C:\!\flutter>flutter doctor
Error: The Flutter directory is not a clone of the GitHub project.
The flutter tool requires Git in order to operate properly;
to set up Flutter, run the following command:
git clone -b stable https://github.com/flutter/flutter.git
Solution: Put your folder at C:\flutter. I don't know why but it fixed this. My PATH is C:\flutter\bin. The "location of the sdk" is C:\flutter.

- 447
- 7
- 8
You have to do the following and the issue will be resolved.
- Put the flutter sdk in some other directory other than C:\Program Files or C:\Program Files (x86), recommended Directory is C:\Users<your username>
- now go to the flutter sdk folder. There will be a folder named bin in it. Open the bin folder and copy the path of this folder say: C:\Users<your username>\flutter\bin and add it in the environment variables.
Now close any opened terminal and re-open it and write >flutter doctor it would run properly.
When I first encountered this error, I felt that's the end cause I couldn't seem to find a solution anywhere. They were all pointing to obvious things I've already done. FYI this is my first time posting answer on Stack Overflow
The solution is:
Simply install git Git Download Link and Node js Node js download link and there's no order to this. After this close all IDE or programs using this and try again.
Yeah, that's all it takes.

- 1
- 2
I have the solution
- go to C:/ in windows
- create a src folder
- into your src folder run this git clone -b stable https://github.com/flutter/flutter.git
- setup your env variables with this path= C:/src/flutter
problem solved!

- 1
- 1