[4:27:20 PM] [General] [Info] Flutter is not initialized, running 'flutter doctor' to force...
[4:27:20 PM] [General] [Info] (PROC 14560) Logging data for process...
[4:27:21 PM] [General] [Info] (PROC 14560) Error: PowerShell executable not found.
Either pwsh.exe or PowerShell.exe must be in your PATH.
[4:27:21 PM] [General] [Info] (PROC 14560) exited (1, null)
What is this error and how can I add PowerShell.exe
to my PATH?
I'll break it down into two parts: what the error is, and how to fix it
First of all, what exactly are Environment Variables? Quoting Wikipedia:
An environment variable is a user-definable value that can affect the way running processes will behave on a computer. Environment variables are part of the environment in which a process runs.
With this in mind, why am I mentioning environment variables? Because as your error states, you need to modify your PATH, which happens to be a common environment variable.
The PATH environment variable stores a collection of directory paths to tell the system where to search, for instance when you call a program name from a terminal.
Flutter requires Powershell in order to install properly, and uses the command Powershell.exe
(referring back to the PATH environment variable) which is typically added to the PATH environment variable by default so it knows where to find and run Powershell
. However, in your case, it appears Powershell.exe
is not in your PATH, thus the error is produced.
To add powershell.exe
to your path, open the Edit environment variables for your account
app built into Windows (you can access it in the Start menu), select the Path
user variable, press Edit...
, press New
, then enter in C:Windows\System32\WindowsPowerShell\v1.0
. Then press Ok
on both windows opened and that should add Powershell to your path. You should then be able to (after reloading the terminal) run flutter
or whatever you were trying to do earlier.
Step-by-step if that giant paragraph was hard to read:
Edit environment variables for your account
(accessible by the Start menu)Path
user variable (under User variables for {your user}
)Edit...
button under that menuNew
C:Windows\System32\WindowsPowerShell\v1.0
and press Ok
Ok
button (on the other window) to save your changes