Home > Article > Backend Development > Why is the \'go\' command not recognized in my terminal?
Error: 'go' Command Not Recognized
After executing the command "go run main.go," you encounter the following error:
go : The term 'go' is not recognized as the name of a cmdlet, function, script file, or operable program. Check the spelling of the name, or if a path was included, verify that the path is correct and try again.
Solution
To fix this error, you need to add the path to the Go executable to your system's environment variables. Here's how:
$env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine")
This will retrieve the current path variable.
;C:\Go\bin
The semicolon (;) separates the new path from the existing path.
$env:Path = $env:Path + ";C:\Go\bin"
You may need to replace "C:Gobin" with the correct path to your Go installation.
Now, you should be able to run the "go run main.go" command without encountering the error.
The above is the detailed content of Why is the \'go\' command not recognized in my terminal?. For more information, please follow other related articles on the PHP Chinese website!