Open asampal opened 2 years ago
I'm not totally sure, but it seems the issue could be triggered when the directory in which .tool-versions
is found is updated as part of a git pull
. I don't know if it always happens as a result, but that action is one possible trigger for the state loss.
I have several students having this same issue under WSL2 when working on Elixir/Phoenix assignments. Thanks for the confirmation of the issue and the workaround. I'll see if I can dig in, reproduce, and see what I can figure out.
asdf
resolves the .tool-versions
on command execution, so the change of state with git
shouldn't affect this. When you exec terraform
after doing a git pull
, asdf
should then lookup the version as the shim executes.
When this happens to someone next, can you please share the following:
asdf current
asdf list
pwd
cat .tool-versions
asdf current
will be the interesting one to see here.
I haven't seen this happening recently. I think the problem stopped after I added .tool-versions
to .gitignore
.
I haven't seen this happening recently. I think the problem stopped after I added
.tool-versions
to.gitignore
.
Well, that's certainly not how we recommend things to work. The whole intent is to capture your .tool-versions
in git
to share.
Of course, just that in my case I'm the only one using asdf so this wasn't an issue. Also, I'm not totally sure that the ignore was what made things work, since I didn't really look further.
Another bit of context which might help is that the git pull operation was done using Windows git (I have a preferred GUI client). Could it be that during these pulls, there were some line ending changes causing the problem?
That could be a potential cause. It is a hard scenario for us to test.
This happened on my mac as well.
"asdf local
Describe the Bug
For some reason, every once in a while asdf will lose knowledge of which tool version to run if there is a
.tool-versions
file for that tool in a directory.asdf list
, when executed in that directory, shows no*
beside any of the tools which are referenced in the.tool-versions
file. An error likeNo <tool> executable found for <tool> <version>
is emitted in this case. Invokingasdf local <tool> <version>
(with the same version referenced in.tool-versions
) will make asdf regain the correct tool version state for the directory in question.Steps to Reproduce
It's not clear what causes the described loss of state for a directory containing a
.tool-versions
file.Expected Behaviour
When a
.tool-versions
file exists, and the tool versions referenced therein are installed, asdf should not end up in a state where the version to be used is unknown.Actual Behaviour
asdf doesn't know which version of a tool it should use.
Environment