You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

运行flutter doctor报错:Windows Version检查崩溃(找不到powershell)

解决Flutter Doctor提示“Failed to find 'powershell' in the search path”问题

问题重现

运行flutter doctor时出现如下错误:

Doctor summary (to see all details, run flutter doctor -v):
[√] Flutter (Channel stable, 3.22.2, on Microsoft Windows [Version 10.0.22631.3880], locale en-US)
[☠] Windows Version (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 "powershell" in the search path.
        Command: powershell

解决方案

  • 定位PowerShell安装路径
    Windows系统中PowerShell默认路径通常是以下两个之一:

    • 传统Windows PowerShell:C:\Windows\System32\WindowsPowerShell\v1.0
    • PowerShell 7(若安装):C:\Program Files\PowerShell\7
      可以直接在文件资源管理器中导航到对应路径,确认powershell.exe存在。
  • 添加路径到系统环境变量

    1. 右键点击「此电脑」→ 选择「属性」→ 点击「高级系统设置」
    2. 在弹出的窗口中切换到「高级」标签页,点击「环境变量」
    3. 在「系统变量」区域找到Path变量,点击「编辑」
    4. 点击「新建」,粘贴刚才确认的PowerShell路径,然后点击「确定」保存所有设置
  • 验证修复效果

    1. 关闭所有已打开的终端窗口(包括CMD、PowerShell、VS Code终端等)
    2. 重新打开一个终端,运行flutter doctor,检查Windows Version项是否恢复正常

如果操作后问题仍存在,建议重启电脑确保环境变量完全生效,或确认PowerShell的实际安装路径是否与上述一致。

内容的提问来源于stack exchange,提问作者Alishba Haider

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.06.20 23:04:54