Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting /bin/jb: not found when I try running make vendor #36

Closed
geerlingguy opened this issue May 23, 2020 · 9 comments
Closed

Getting /bin/jb: not found when I try running make vendor #36

geerlingguy opened this issue May 23, 2020 · 9 comments

Comments

@geerlingguy
Copy link
Contributor

When I try running make vendor after customizing my vars.jsonnet file, I keep getting:

$ make vendor
Installing jsonnet-bundler
rm -rf vendor
``/bin/jb install
/bin/sh: 1: /bin/jb: not found
make: *** [Makefile:26: vendor] Error 127

It seems like the path /bin/jb is hardcoded, but when it installs jsonnet-bundler it is running with my local GOPATH, which is ~/go, so jb is installed in ~/go/bin/jb and not in the global /bin dir.

Can the makefile be updated to work with just calling jb instead? I have added the go bin path to my user's $PATH as well, but since the /bin/jb location is hardcoded, I have to manually add a symlink or install as root, which is a little strange.

@geerlingguy
Copy link
Contributor Author

Ah, I think I was a bit confused...

If I run $ go env GOPATH it output /home/myuser/go.

However, the $GOPATH env var was not set, which the Makefile uses. So I had to also export GOPATH=/home/myuser/go so the environment variable was set. (Also note that you can't set GOPATH=~/go because you get the error:

go: GOPATH entry cannot start with shell metacharacter '~'

@carlosedp
Copy link
Owner

Weird because in the makefile, it's like:

GOPATH ?= `$(pwd)`

JSONNET_BIN := $(GOPATH)/bin/jsonnet
JB_BINARY := $(GOPATH)/bin/jb

It should install in your GOPATH if it's already defined otherwise it would install into current dir (pwd).

@carlosedp
Copy link
Owner

Yes, it must be an absolute path. I just tested without the GOPATH variable and it really fails. I will change the Makefile to warn the user to have the GOPATH set.

Did it work this way?

@geerlingguy
Copy link
Contributor Author

That's weird, $GOPATH was definitely empty (confirmed with an echo and env), and go installed the bins in ~/go/bin.

My workaround worked fine, and right now I don't have time to dig in any deeper (already burned about 4 more hours on this task than I planned; this repo has saved me a lot of time ;).

Feel free to close this issue, and hopefully if someone else who fights with GOPATH and env vars like I do so often has the same problem, Google will lead them here :)

@carlosedp
Copy link
Owner

Nice! Glad it helped. I'll take a look into this to avoid further problems like this :)

@carlosedp
Copy link
Owner

carlosedp commented May 23, 2020

Fixed by a6a1133. Can you check?

@geerlingguy
Copy link
Contributor Author

@carlosedp Testing now.

@geerlingguy
Copy link
Contributor Author

geerlingguy commented May 23, 2020

It looks like that worked! I dropped all my workarounds and it's picking up the GOPATH correctly.

One weird thing is all the manifests are there, but completely empty after I make vendor && make... not sure what's up with that (I'm running Go 1.11), but if I determine it's something not my fault I may open a separate issue. (This issue occurred prior to this commit though, so this commit didn't introduce a regression there.)

@geerlingguy
Copy link
Contributor Author

The fix worked for the GOPATH, but I did find another issue and I'll open up a separate issue for it (it's unrelated).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants