美文网首页
Go常见问题(一)Visual Studio Code 无法识别

Go常见问题(一)Visual Studio Code 无法识别

作者: 又语 | 来源:发表于2021-12-04 17:17 被阅读0次

    问题现象

    PS D:\...> go env
    go : 无法将“go”项识别为 cmdlet、函数、脚本文件或可运行程序的名称。请检查名称的拼写,如果包括路径,请确保路径正确,然后再试一次。
    所在位置 行:1 字符: 1
    + go env
    + ~~
        + CategoryInfo          : ObjectNotFound: (go:String) [], CommandNotFoundException
        + FullyQualifiedErrorId : CommandNotFoundException
    

    原因分析

    Go安装路径发生变化。

    解决方案

    在VS Code终端(PowerShell实例)中运行以下命令,使当前的PowerShell实例从计算机加载最新的路径变量。

    $env:Path = [System.Environment]::GetEnvironmentVariable("Path","Machine")
    

    相关文章

      网友评论

          本文标题:Go常见问题(一)Visual Studio Code 无法识别

          本文链接:https://www.haomeiwen.com/subject/chhmtrtx.html