gcloud app deploy says: exec: "git": executable file not found in $PATH

Nik Silver :

I am struggling to deploy a simple Go app to Google App Engine flexible environment. (This is a very cut-down version of a larger app.) When I run gcloud app deploy --project=<projectID> it terminates with an error, and has this in its output:

...
Step #0: Status: Downloaded newer image for gcr.io/gcp-runtimes/go1-builder@sha256:68b86e4c97438df4c9e36c55ad724079b453398a0a44c29748fb5685eef73895
Step #0: gcr.io/gcp-runtimes/go1-builder@sha256:68b86e4c97438df4c9e36c55ad724079b453398a0a44c29748fb5685eef73895
Step #0: go: github.com/go-stack/[email protected]: git init --bare in /workspace/_gopath/pkg/mod/cache/vcs/6963ea18be763686e7a9697733dd92bfcc0d45b687afce82da04992523d91cd1: exec: "git": executable file not found in $PATH
Step #0: go: github.com/inconshreveable/[email protected]: git init --bare in /workspace/_gopath/pkg/mod/cache/vcs/fe2a07d0f4107d9daa39043733e909094a5b926cca44d0f7269e7a2185dbef15: exec: "git": executable file not found in $PATH
Step #0: go: github.com/mattn/[email protected]: git init --bare in /workspace/_gopath/pkg/mod/cache/vcs/f7e99db597f4d2fe3e4509a9af308dace72a13292b505deb909cd0df29c1468a: exec: "git": executable file not found in $PATH
Step #0: go: error loading module requirements
Finished Step #0

It does work if I delete go.mod, but (I think) I need go.mod to compile and test it locally. It does work if I don't import the external package, but of course I need external packages in my larger app. It does work if I choose the standard environment, but I need the flexible environment for my larger app.

How can I deploy this app successfully to a flexible environment?

My local Go is 1.13, and I have the latest version (292.0.0) of gcloud. Apart from go.sum, the contents of my directory is...

app.yaml:

runtime: go1.12
env: flex

go.mod:

module mymodulename

go 1.13

require (
        github.com/go-stack/stack v1.8.0 // indirect
        github.com/inconshreveable/log15 v0.0.0-20200109203555-b30bc20e4fd1
        github.com/mattn/go-colorable v0.1.6 // indirect
)

main.go:

package main

import (
        "fmt"
        "net/http"
        "os"

        "github.com/inconshreveable/log15"
)

func main() {
        log := log15.New()

        http.HandleFunc("/", helloHandler)

        port := os.Getenv("PORT")
        if port == "" {
                port = "8080"
                log.Info("Using default port", "port", port)
        }

        log.Info("Listening", "port", port)
        if err := http.ListenAndServe(":"+port, nil); err != nil {
                log.Crit("ListenAndServe", "error", err)
                os.Exit(1)
        }
}

func helloHandler(w http.ResponseWriter, r *http.Request) {
        fmt.Fprint(w, "Hello, there")
}

Thank you.

DazWilkin :

IIUC Flexible doesn't support modules (Standard does, go figure!).

You can:

  • either use a custom runtime;
  • or, delete the go.mod|go.sum and try again.

I copied your app.yaml and main.go and it worked for me.

One change to your app.yaml:

runtime: go
env: flex

Then:

go get github.com/inconshreveable/log15
go run main.go
INFO[05-15|09:33:26] Using default port                       port=8080
INFO[05-15|09:33:26] Listening                                port=8080

and:

curl --silent http://localhost:8080
Hello, there

and:

gcloud app deploy --project=${PROJECT}
curl --silent $(\
  gcloud app describe \
  --project=${PROJECT} \
  --format="value(defaultHostname)")
Hello, there

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

exec: executable file not found in $PATH

CloudFoundry staging error exec: "git": executable file not found in $PATH

"exec: \"go\": executable file not found in $PATH"

exec: "sqlboiler": executable file not found in $PATH

godep: exec: "go": executable file not found in $PATH

"exec: "python": executable file not found in $PATH

gcloud composer command fails "executable file not found in $PATH"

Docker Go image: starting container process caused: exec: "app": executable file not found in $PATH: unknown

Error: exec: \"app.handler\": executable file not found in $PATH", "errorType": "Runtime.InvalidEntrypoint"

"sqlplus": executable file not found in $PATH" when running a command with docker exec

docker-exec failed: "cd": executable file not found in $PATH

System error: exec: "deployment": executable file not found in $PATH

exec: "gcc": executable file not found in %PATH% when trying go build

docker local registry "exec: \"htpasswd\": executable file not found in $PATH"

Go moq : running "moq": exec: "moq": executable file not found in $PATH

exec: "com.docker.cli": executable file not found in $PATH

exec: "docker-runc": executable file not found in $PATH: unknown

exec: "php-fpm": executable file not found in $PATH: unknown

Executable file not found in $PATH

pvm says file not found when running an executable

starting container process caused "exec: > \"exec\": executable file not found in $PATH": unknown

cgo: exec gcc: exec: "gcc": executable file not found in $PATH Error in Egress operator installation

executable file not found in $PATH Dockerfile

docker: executable file not found in $PATH

executable file not found in $PATH: unknown

Getting error executable file not found in $PATH when trying verbose run docker container or when docker exec

Golang docker multi-stage build failing to run: exec: "go": executable file not found in $PATH

Docker Base Simple image : Cannot start container XXX: exec: "cat": executable file not found in $PATH

Error running docker container: starting container process caused "exec: \"python\": executable file not found in $PATH": unknown