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

"asdf: No preset version installed for command which" #769

Closed
polarathene opened this issue Aug 3, 2020 · 2 comments
Closed

"asdf: No preset version installed for command which" #769

polarathene opened this issue Aug 3, 2020 · 2 comments

Comments

@polarathene
Copy link

Describe the bug

asdf is shimming some commands like which for some reason? As the asdf.sh file modifies PATH env var to place itself ahead of any other binaries(understandable), it's refusing to let the command work..

asdf/asdf.sh

Lines 23 to 29 in e0142ee

ASDF_BIN="${ASDF_DIR}/bin"
ASDF_USER_SHIMS="${ASDF_DATA_DIR:-$HOME/.asdf}/shims"
[[ ":$PATH:" == *":${ASDF_BIN}:"* ]] && PATH="${PATH//$ASDF_BIN:/}"
[[ ":$PATH:" == *":${ASDF_USER_SHIMS}:"* ]] && PATH="${PATH//$ASDF_USER_SHIMS:/}"
# add to front of $PATH
PATH="${ASDF_BIN}:$PATH"
PATH="${ASDF_USER_SHIMS}:$PATH"

Can be any binary queried with which, not necessarily something that asdf manages, still outputs this(run in a directory that isn't a nodejs project which is all I use asdf for presently):

$ which grep
asdf: No preset version installed for command which
Please install the missing version by running one of the following:

asdf install nodejs 14.4.0

or add one of the following in your .tool-versions file:

nodejs 11.3.0

That's probably due to the issue described here: #557 , since I do have such configured properly afaik:

$ asdf current
nodejs         14.4.0   (set by /home/polarathene/.tool-versions)

If the command cannot be run for whatever reason, then is it possible to run the system utility instead of blocking it like it is presently? I could delete the shim, but I assume it's there for a reason (unclear why though as the system binary should work just the same? I suppose it's adding an additional location to search for binaries).

To Reproduce

I have no idea, I've only setup asdf on linux and installed node, then at some point this year installed a newer version of Node.

Expected behavior

I'd expect which to work.

Actual behavior

asdf complained about not being configured for the command which? Preventing it from being used even though there is a system utility.

Environment

OS: Manjaro Linux (latest updates, no versions as it's rolling release)

asdf version: version: v0.7.8-4a3e3d6

asdf plugins installed: nodejs

@polarathene
Copy link
Author

I do recall many months ago finding which processes that were active and draining CPU for some reason and they were being spawned from the asdf which binary. I haven't seen that cause any issues since, so I assume that's no longer an issue, just mentioning it as a related issue I recall with asdf and which.

@polarathene
Copy link
Author

polarathene commented Aug 3, 2020

Docs suggested using the direnv plugin which might of worked(didn't try it) as it apparently bypasses the shims.

Deleted the older nodejs version, and the which shim along with many others were removed. So the error suggesting the solution at the end probably would have worked by switching to the older version? It just wasn't clear about why it was suggesting the older version.

Closing as effectively resolved, which binary was installed by some global package in the earlier nodejs version or by that version the plugin provided itself. Not used in the newer version installed, hence the confusion :)

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

1 participant