Identify different class of error between *missing version* from *requiring a reshim*
- Dominant language
- Go
- Stars
- 25.6k
- Forks
- 941
- Avg merge
- 9h 24m
- Merged PRs (30d)
- 3
Description
**Describe the bug**
We get a number of bug reports around the error `No preset version installed for command ` message. Some of the time the set version for the tool is not installed and this error message is correct. Other times it is not correct because the version is installed as required, but the plugin requires a reshim as a binary was installed using the tool and `asdf` needs to create a shim for the new binary.
We see this with any tool that can install binaries through it's own package manager (Ruby, Golang, Node.js etc)
The most recent example is https://github.com/asdf-vm/asdf/issues/914 is an example of this:
```
No preset version installed for command
Please install a version by running one of the following:
asdf install golang 1.16.2
or add one of the following versions in your config file at HOME/.tool-versions
golang 1.15.1
```
where the `` was installed and **used** before reshimming the plugin (`asdf reshim golang`).
**To Reproduce**
See #914
**Expected behavior**
As mentioned by OP in https://github.com/asdf-vm/asdf/issues/914#issuecomment-827180264 the error message should notify the user to reshim when the specified version of the tool is installed.
Auto reshimming (#409 / #446) would resolve this class of errors. Notably, plugins can run the reshim themselves. The Node.js plugin uses the npm postinstall hook to run the reshim after installation (the Node package manager used must support the npm hooks though so this may be a brittle soln.)
**Actual behavior**
We get an indication to install the tool instead of reshim.
### Environment
Copied from #914
```shell
OS:
Darwin Kalorme 20.2.0 Darwin Kernel Version 20.2.0: Wed Dec 2 20:39:59 PST 2020; root:xnu-7195.60.75~1/RELEASE_X86_64 x86_64
SHELL:
zsh 5.8 (x86_64-apple-darwin20.0)
ASDF VERSION:
v0.8.0
ASDF ENVIRONMENT VARIABLES:
ASDF_DIR=/usr/local/opt/asdf
ASDF INSTALLED PLUGINS:
golang https://github.com/kennyp/asdf-golang.git
minio https://github.com/aeons/asdf-minio.git
nodejs https://github.com/asdf-vm/asdf-nodejs.git
postgres https://github.com/smashedtoatoms/asdf-postgres.git
protoc https://github.com/paxosglobal/asdf-protoc.git
python https://github.com/danhper/asdf-python.git
redis https://github.com/smashedtoatoms/asdf-redis.git
ruby https://github.com/asdf-vm/asdf-ruby.git
yarn https://github.com/twuni/asdf-yarn.git
```
Contributor guide
Research direction
Start by reproducing the behavior described in #914: install a binary through a tool such as golang, invoke it before and after `asdf reshim golang`, and compare the resulting error. Trace how asdf distinguishes an uninstalled configured version from a missing shim, then verify that the completed change gives reshim guidance when the version is installed and install guidance otherwise.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, node.js, ruby
- Domain
- cli, tooling
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100