Flutter - running command "flutter _____" instantly closes terminal

5,420

Solution 1

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

Solution 2

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.

Solution 3

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%"

Solution 4

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

Share:
5,420
Admin
Author by

Admin

Updated on December 24, 2022

Comments

  • Admin
    Admin over 1 year

    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

  • greybeard
    greybeard about 3 years
    What is check power shell. to mean? How does this improve on SUDHANSHU SHARMA's Mar 22 answer?
  • H.Z music
    H.Z music about 3 years
    Power shell path in system variables