vugu / vgrun

Command line Vugu runner utility
MIT License
4 stars 3 forks source link

Running vgrun devserver.go (Error) #2

Closed wr125 closed 3 years ago

wr125 commented 3 years ago

Just followed the install process of vugu Getting Started but receive the following error message in my terminal: " vgrun devserver.go 2020/07/05 09:42:51 initial build error: generate error: exit status 1; full output: generate.go:3: running "vugugen": exec: "vugugen": executable file not found in $PATH"

Instructions followed: (1) I have added the line of code to my ./bashrc file - export PATH="$PATH:usr/local/go/src/vugugen" but still does not work?

(2) I've also run the script - go generate generate.go:3: running "vugugen": exec: "vugugen": executable file not found in $PATH

(3) Plus, in terminal, go generate vugugen -s can't load package: package vugugen is not in GOROOT (/usr/local/go/src/vugugen) can't load package: package -s is not in GOROOT (/usr/local/go/src/-s)

What was I expecting? To just work by going to localhost:8080

bradleypeabody commented 3 years ago

Normally the vugugen executable is installed at "go/bin/vugugen" underneath your home directory. So if your username is wr125 this would be /home/wr125/go/bin/vugugen

On most systems Go will also place this bin folder e.g. /home/wr125/go/bin (or replace "home" with "Users" on a Mac) in your PATH automatically. Can you please provide the output of go env and echo $PATH? That might help us both see in more detail what is happening.

Also please check the bin dir mentioned above ($HOME/go/bin) and see if there is a vugugen executable in there on your system.

wr125 commented 3 years ago

Hello bradleypeabody - thanks for looking.

$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/urs/.cache/go-build" GOENV="/home/urs/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/urs/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/local/go" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="" CGO_CFLAGS="-g -O2" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-g -O2" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build891392039=/tmp/go-build -gno-record-gcc-switches"

Plus I looked in the directory of the original install of vugu and in there is an empty bin folder (not sure if that helps at all).

$ echo $PATH ~/go/bin:/home/urs/.nvm/versions/node/v13.11.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/games:/usr/local/games:/usr/local/go/bin:/usr/local/tinygo/bin

bradleypeabody commented 3 years ago

@wr125 Thanks for that info. Your PATH should be fine as-is. If you do ls -l ~/go/bin/vugugen does it show the file there or do you get an error about the file not existing?

If that file doesn't exist, try running go install github.com/vugu/vugu/cmd/vugugen and see if that makes the file show up. (That command is normally run by vgrun as part of it's startup, possibly that failed earlier.)

bradleypeabody commented 3 years ago

Actually, I think ~/go/bin might be the issue. This post has some explanation: https://unix.stackexchange.com/questions/154281/path-environment-variable-does-not-seem-to-be-recognized

The tilde character is meant to expanded by the shell, often when an environment variable is set. I.e. echo $PATH should have an entry like /home/urs/go/bin rather than ~/go/bin. If you set your path like that, I'd check and see if that solves the problem. e.g.:

(exact same path value from your post but with /home/urs substituted for ~)

export PATH=/home/urs/go/bin:/home/urs/.nvm/versions/node/v13.11.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/games:/usr/local/games:/usr/local/go/bin:/usr/local/tinygo/bin

I suspect that with that change, following the Vugu Getting Started directions from the top would then work - or at least it's worth trying that again to see.

wr125 commented 3 years ago

A quick check and there is an executable file named vugugen and vugu in the "go/bin" directory. So when I run go generate vugugen -s we get the message - can't load package: package vugugen is not in GOROOT (/usr/local/go/src/vugugen). So its not looking for the executable (vugugen) in the "go/bin" directory but in /usr/local/go/src instead!

bradleypeabody commented 3 years ago

The go generate command accepts a package name as its argument, or with no argument looks in the current directory for the package (hence the error message can't load package: package vugugen...).

The normal flow is:

wr125 commented 3 years ago

ok so my ./bashrc file is set to export GOPATH=$HOME/go and also PATH=$PATH:/usr/local/tinygo/bin. Is this correct? Since go generate vugugen -s flag command is searching for GOROOT path at usr/local/go/src/vugugen

wr125 commented 3 years ago

New output - echo $PATH /home/urs/go/bin:/home/urs/.nvm/versions/node/v13.11.0/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin:/usr/games:/usr/local/games:/usr/local/go/bin:/usr/local/tinygo/bin. Still no joy. Also tried installing files to a different environment https://repl.it/@wr125/ but still unable to get vgrun script to work.

wr125 commented 3 years ago

I managed to get vgrun script and server to run by adding the following lines of code to the ~/.profile (file) (1) export GOPATH=$HOME/go (which is the recommended default path for go) (2) export PATH=$PATH:$GOPATH/bin (execute go binaries from this path) (3) export PATH=$PATH:$GOPATH/bin:/usr/local/go/bin (execute go binaries from anywhere in your linux system)

bradleypeabody commented 3 years ago

@wr125 Ok great! Glad it's working.