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

"No preset version installed, Please install a version" when version is already installed [golang] #914

Closed
firelizzard18 opened this issue Apr 3, 2021 · 12 comments

Comments

@firelizzard18
Copy link

Describe the bug

asdf tells me "no preset version installed, please install " when that version is already installed.

To Reproduce

# asdf install
golang 1.16.2 is already installed
nodejs 14.13.0 is already installed
postgres 12.4 is already installed
protoc 3.15.6 is already installed
python 3.9.1 is already installed
ruby 2.6.6 is already installed
yarn 1.22.10 is already installed
# dlv version 
No preset version installed for command dlv
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
# ls ~/.asdf/installs/golang/1.16.2/packages/bin/dlv 
HOME/.asdf/installs/golang/1.16.2/packages/bin/dlv*
# go install github.com/go-delve/delve/cmd/dlv@latest
# dlv version                                        
No preset version installed for command dlv
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

Expected behavior

Delve should run

Actual behavior

I get a useless (and wrong) error message.

Environment

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
@jsmestad
Copy link

I hit this as well with the Ruby plugin

@jthegedus
Copy link
Contributor

@jsmestad #557 discusses this issue with regards to Ruby

@jthegedus
Copy link
Contributor

jthegedus commented Apr 26, 2021

@firelizzard18

A few questions:

@jthegedus jthegedus changed the title "No preset version installed, Please install a version" when version is already installed "No preset version installed, Please install a version" when version is already installed [golang] Apr 26, 2021
@firelizzard18
Copy link
Author

firelizzard18 commented Apr 26, 2021

@jthegedus

  • I manually fixed my issue by adding # asdf-plugin: golang 1.16.2 to the shim.
  • A number of months ago I had a very similar issue with Ruby shims, but adding # asdf-plugin: ruby x.y.z to the shim did not work. I don't recall how I fixed it.
  • It does happen with other golang binaries.
  • asdf reshim golang fixed it (by adding # asdf-plugin: golang 1.16.2)

I understand why this might be difficult to fix directly, possibly infeasibly difficult. In that case, I think I would prefer a better error message. The current message is No preset version installed for command dlv [...]]] running one of the following [...] asdf install golang 1.16.2. I read this as "golang 1.16.2 is not installed", which is incorrect. At the least, this error message should be updated to something that is not *incorrect. Ideally, I'd like to see the following:

The shim for command dlv is out of date
Please run `asdf reshim golang` to correct this

This would require detecting that ~/.asdf/installs/golang/1.16.2/packages/bin/dlv exists. Second best would be:

Command dlv is not installed for golang 1.16.2
Please install dlv or add one of the following versions in your config file at HOME/.tool-versions
golang 1.15.1

If this is incorrect, please run `asdf reshim golang`

@jthegedus
Copy link
Contributor

jthegedus commented Apr 27, 2021

@firelizzard18 Yes, we need to improve the error here. We need to identify between

  • executing a shim that doesn't exist
  • an entire version of the root tool (golang) not existing

I will close this issue since you resolved it with asdf reshim golang (which is expected behaviour and a userland requirement). I will create a new issue with your comments here about improving the error.

#557 outlines a similar issue (this error message is output) but with Ruby and a missing required shim which was caused by an upstream Ruby change.

@pranavkedia
Copy link

I faced the same problem. Here was my steps to fix the problem

  • Ensured I have only one asdf by running where asdf
  • Ensured I have the right version of golang tool chain.
  • Ran asdf reshim
  • In vscode using the command palette updated all the go tools, followed by vscode restart. Had to do this twice.

@kennyp
Copy link
Contributor

kennyp commented Feb 11, 2022

Yes, you're going to run into this issue when you do a go install under one version and then switch to a different directory with a different version of Go in your .tool-versions. We could play around with the shims, but mostly I avoid the issue by having the binaries that are used all over as a part of my default packages.

@eric-burel
Copy link

For lost googlers: be careful not to have legacy settings such as a ".nvmrc", this message can mean that asdf is trying to use the version listed in your ".nvmrc" while it's not installed. Either remove the ".nvmrc" to replace by a ".tool-versions", install the required version of node, or update ".nvmrc" to a version that is installed on your machine.

@claywd
Copy link

claywd commented Jun 27, 2023

for me the next time I run into this problem...

vim ~/.asdf/shims/dlv
add # asdf-plugin: golang 1.xx.xx
asdf reshim

@cristianoliveira
Copy link

cristianoliveira commented Sep 12, 2023

@claywd

for me the next time I run into this problem...
vim ~/.asdf/shims/dlv
add # asdf-plugin: golang 1.xx.xx
asdf reshim

This actually was the only thing that worked for me, sadly, I tried all the builtin commands.

@piotrpalek
Copy link

for anyone stopping by because they've got such an error with nodejs, check out: asdf-vm/asdf-nodejs#295

@ardinusawan
Copy link

#914 (comment)

When execute asdf reshim the config ~/.asdf/shims/dlv is being resetted 🤔

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

10 participants