Flutter breaking after installing Git for Windows (VS Code shows "The Flutter Daemon failed to start" and "flutter doctor" closes CMD window)

huangapple go评论130阅读模式
英文:

Flutter breaking after installing Git for Windows (VS Code shows "The Flutter Daemon failed to start" and "flutter doctor" closes CMD window)

问题

在我的Windows 10电脑上安装Git for Windows后,我在使用Flutter时遇到了问题。当我启动Visual Studio Code时,它显示错误消息"The Flutter Daemon failed to start." 此外,在命令提示符(CMD)中运行"flutter doctor"会自动关闭CMD窗口而没有输出。当我卸载Git Bash时,似乎这个问题得到了解决,但在重新安装Git for Windows后,问题重新出现。

然而,当我以管理员身份运行cmd和vs code时,它可以正常工作。

是否有其他人遇到类似的问题,如何在不每次卸载Git for Windows的情况下修复Flutter?任何见解或解决方案将不胜感激。谢谢!

英文:

After installing Git for Windows on my Windows 10 machine, I encountered a problem with Flutter. When I launch Visual Studio Code, it displays the error message "The Flutter Daemon failed to start." Additionally, running flutter doctor in the Command Prompt (CMD) automatically closes the CMD window without output. This issue seemed to be resolved when I uninstalled Git Bash, but after reinstalling Git for Windows, the problem reappeared.

However, it is working when I run cmd and vs code as an administrator

Has anyone else experienced a similar issue, and how can I fix Flutter without uninstalling Git for Windows every time? Any insights or solutions would be greatly appreciated. Thanks!

答案1

得分: 0

我通过在Git Bash中运行命令git config --global --add safe.directory ''*''来解决了Windows上的这个问题。之后,我重新启动了我的IDE和常规命令提示符,现在Flutter可以在不需要管理员权限的情况下工作了。您可以在这里找到更多详细信息。祝编码愉快!

英文:

I solved this issue on Windows by running the command git config --global --add safe.directory '*' in Git Bash. After that, I restarted my IDE and regular Command Prompt, and now Flutter works without requiring administrator privileges. You can find more details here. Happy coding!

huangapple
  • 本文由 发表于 2023年8月5日 12:39:49
  • 转载请务必保留本文链接:https://go.coder-hub.com/76840154.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定