Flutter 我对颤振有一个问题:“where”不被识别为内部或外部命令

Flutter 我对颤振有一个问题:“where”不被识别为内部或外部命令,flutter,cmd,Flutter,Cmd,我正面临着我的颤振问题,当我在命令“颤振医生”中写道: where' is not recognized as an internal or external command, operable program or batch file. Error: Unable to find git in your PATH. 然后,当我以管理员身份运行命令并编写“颤振医生”时: Doctor summary (to see all details, run flutter doctor -v): [

我正面临着我的颤振问题,当我在命令“颤振医生”中写道:

where' is not recognized as an internal or external command,
operable program or batch file.
Error: Unable to find git in your PATH.
然后,当我以管理员身份运行命令并编写“颤振医生”时:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.18362.1256], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc4)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Community Edition (version 2020.3)
[√] VS Code (version 1.56.2)
[☠] Connected device (the doctor check crashed)
    X Due to an error, the doctor check did not complete. If the error message below is not helpful, please let us know
      about this issue at https://github.com/flutter/flutter/issues.
    X ProcessException: Failed to find "reg" in the search path.
        Command: reg

! Doctor found issues in 1 category.
在android studio中,我得到:

Error: PowerShell executable not found.                         
       Either pwsh.exe or PowerShell.exe must be in your PATH.
我该怎么办

当我在命令中写入set path时,我得到:

C:\Users\DELL>set path
path=C:\Windows\System32\WindowsPowerShell\v1.0;C:\Users\DELL\anaconda3;C:\Users\DELL\anaconda3\Library\mingw-w64\bin;C:\Users\DELL\anaconda3\Library\usr\bin;C:\Users\DELL\anaconda3\Library\bin;C:\Users\DELL\anaconda3\Scripts;C:\Users\DELL\AppData\Local\Programs\Python\Python39\Scripts\;C:\Users\DELL\AppData\Local\Programs\Python\Python39\;C:\Users\DELL\AppData\Local\Microsoft\WindowsApps;C:\Users\DELL\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\DELL\Downloads\flutter_windows_v1.12.13+hotfix.8-stable\flutter\bin;C:\Users\DELL\AppData\Roaming\npm;C:\php;C:\dart-sdk\bin;C:\flutter\bin;
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
伙计们,我找到了答案: 我去了env=>System variables=>path如果你没有创建一个=>我添加了以下路径:

C:\flutter\bin;
C:\Windows\System32;
C:\Program Files\Git\bin\git.exe;
C:\Program Files\Git\cmd;
C:\Windows\System32\WindowsPowerShell\v1.0
现在它起作用了

C:\Users\DELL>flutter doctor
Running "flutter pub get" in flutter_tools...                      14.1s
Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 2.2.1, on Microsoft Windows [Version 10.0.18362.1256], locale en-US)
[√] Android toolchain - develop for Android devices (Android SDK version 30.0.0-rc4)
[√] Chrome - develop for the web
[√] Android Studio (version 4.1.0)
[√] IntelliJ IDEA Community Edition (version 2020.3)
[√] VS Code (version 1.56.2)
[√] Connected device (1 available)

• No issues found!
哦,很明显这不是一个非常正确的答案,所以被问到的输出是:


C:\Users\DELL>%SystemRoot%\System32\reg.exe Query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /V Path

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
    Path    REG_SZ    C:\flutter\bin;C:\Windows\System32;C:\Program Files\Git\bin\git.exe;C:\Program Files\Git\cmd;C:\Windows\System32\WindowsPowerShell\v1.0;

而对于

C:\Users\DELL\Downloads\flutter_windows_v1.12.13+hotfix.8-stable\flutter\bin
我想我会删除它,因为它是一个旧的,我不使用它

因此,在建议的修改之后,输出如下所示:


C:\Users\DELL>%SystemRoot%\System32\reg.exe Query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /V Path

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
    Path    REG_EXPAND_SZ    %SYSTEMDRIVE%\flutter\bin;C:\Windows\System32;%PROGRAMFILES%\Git\bin;%PROGRAMFILES%\Git\cmd;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\OpenSSH;%SYSTEMDRIVE%\php;%SYSTEMDRIVE%\dart-sdk\bin;
以及:


您已破坏%PATH%变量。你有使用set with path的命令吗?如果没有,请打开命令提示窗口,键入set path,按[ENTER]键,然后使用将输出发布到问题区域。如果您有,请发布您正在使用的set命令,其中包含path。是的,我是正确的,您已经修改了path变量,在这样做的过程中,破坏了它。如果要修复它,应首先发布这两个命令的输出。%SystemRoot%\System32\reg.exe查询HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment/V路径,以及%SystemRoot%\System32\reg.exe查询HKCU\Environment/V路径。您还应该发布您正在使用的Microsoft Windows版本。谢谢@Compo我刚刚修复了它,现在输出正确。您所做的只是部分正确,不是完全正确。顺便说一句,您也可以使用相同的方法检索您的Windows版本,%SystemRoot%\System32\reg.exe查询HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion/V ProductName这仍然不正确,请在我的评论中提供我的请求的答案。您需要特别注意C:\Users\DELL\Downloads\flatter\u Windows\u v1.12.13+hotfix.8-stable\flatter\bin的位置/位置,因为如果它包含与C:\flatter\bin中相同的可执行文件,则将不再使用\Downloads\位置中的可执行文件。以前那个位置是第一位的,但现在你修改了它,它不再会。查看在命令提示符中输入的路径的输出,并注意新的顺序,以及可能重复的C:\flatter\bin!在搜索%PATH%以查找可执行文件匹配项时,只使用找到的第一个匹配项。此外,在上面提交的解决方案中,C:\Program Files\Git\bin\Git.exe不是有效项!在使用Windows 10时,GUI中系统路径的内容应如下所示,顺序为:%SYSTEMROOT%\System32,%SYSTEMROOT%,%SYSTEMROOT%\System32\Wbem,%SYSTEMROOT%\System32\WindowsPowerShell\v1.0,%SYSTEMROOT%\System32\OpenSSH,%SYSTEMDRIVE%\php,%SYSTEMDRIVE%\dart sdk\bin,%SYSTEMDRIVE%\Flatter\bin,%PROGRAMFILES%\Git\bin,和%PROGRAMFILES%\Git\cmd。GUI中用户路径的内容应为thiese,顺序为:%USERPROFILE%\AppData\Local\Microsoft\WindowsApps,%USERPROFILE%\AppData\Local\Programs\Microsoft VS Code\bin,%USERPROFILE%\AppData\Local\Programs\Python39,%USERPROFILE%\AppData\Local\Programs\Python39\Scripts,%USERPROFILE%\anaconda3,%USERPROFILE%\anaconda3\Library\mingw-w64\bin,%USERPROFILE%\anaconda3\Library\usr\bin,%USERPROFILE%\anaconda3\Library\bin,%USERPROFILE%\anaconda3\Scripts和%USERPROFILE%\AppData\Roaming\npm。

C:\Users\DELL>%SystemRoot%\System32\reg.exe Query "HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Environment" /V Path

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Environment
    Path    REG_EXPAND_SZ    %SYSTEMDRIVE%\flutter\bin;C:\Windows\System32;%PROGRAMFILES%\Git\bin;%PROGRAMFILES%\Git\cmd;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0;%SystemRoot%\System32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\System32\OpenSSH;%SYSTEMDRIVE%\php;%SYSTEMDRIVE%\dart-sdk\bin;
C:\Users\DELL>%SystemRoot%\System32\reg.exe Query HKCU\Environment /V Path

HKEY_CURRENT_USER\Environment
    Path    REG_EXPAND_SZ    %USERPROFILE%\anaconda3;%USERPROFILE%\anaconda3\Library\mingw-w64\bin;%USERPROFILE%\anaconda3\Library\usr\bin;%USERPROFILE%\anaconda3\Library\bin;%USERPROFILE%\anaconda3\Scripts;%USERPROFILE%\AppData\Local\Programs\Python\Python39\Scripts;%USERPROFILE%\AppData\Local\Programs\Python\Python39;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps;%USERPROFILE%\AppData\Roaming\npm;C:\php;C:\dart-sdk\bin;C:\flutter\bin;%USERPROFILE%\AppData\Local\Programs\Microsoft VS Code\bin;