Asdf: `asdf: No version set for command which`

Created on 23 Oct 2019  路  6Comments  路  Source: asdf-vm/asdf

Steps to reproduce

No idea.

Expected behavior

which is a system level binary and shouldn't be taken over by asdf.

Actual behavior

Running which by itself prints asdf: No version set for command which. What in the world?!?

Environment

OS: macOS Mojave

asdf version: 0.7.4

Most helpful comment

Happening for me too, I already "unshimmed" which quite some times already, but asdf reshim which is required to "fix" certain situations always re-adds it.

Decided to look more into it, I'm pretty sure this is a "works for me" scenario, but when checking ~/.asdf/shims/which I saw the following:

image

asdf gives you the knowledge of which (no pun intended) node versions use this invalid "which".

In my case, nodejs 12.2.0 was the culprit, I removed it by issueing asdf uninstall nodejs 12.2.0 and then ran asdf reshim, afterwards I could use which normally once again.

To check out if it would re-appear when reinstalling 12.2.0 what I did was asdf install nodejs 12.2.0 followed by an asdf reshim. This time, I was able to keep using which normally as well.

So no need to remove all node versions and the asdf node plugin, just reinstall the offending node versions mentioned in ~/.asdf/shims/which and asdf reshim afterwards.

Weird stuff, easily fixed permanently though (fortunately). Hope this helps!

All 6 comments

Can you check what hijacked which with \type which?

My solution was to completely uninstall all versions of node _and_ uninstall the plugin from asdf and then reinstall. No idea what did it. I promise I didn't do anything weird or out of the ordinary. Just basic standard npm stuffs. 馃し鈥嶁檪

I'm experiencing this issue as well:

$ which
usage: which [-as] program ...
$ source ~/.asdf/asdf.fish
$ which
asdf: No version set for command which
you might want to add one of the following in your .tool-versions file:

nodejs 8.12.0
$ asdf plugin list
nodejs
ruby
$ /usr/bin/which which
/Users/dean/.asdf/shims/which
~/.asdf/shims ((v0.7.6))$ cat which
#!/usr/bin/env bash
# asdf-plugin: nodejs 8.12.0
exec /Users/dean/.asdf/bin/asdf exec "which" "$@"

removing this file resolved it - I didn't track it down, but I'm guessing it's a node executable that conflicts.

Yeah, there is a npm package that seems to get installed that specifies its own version of which. Sorry to not have a solution to this, but the only option right now is to just not use that package.

Happening for me too, I already "unshimmed" which quite some times already, but asdf reshim which is required to "fix" certain situations always re-adds it.

Decided to look more into it, I'm pretty sure this is a "works for me" scenario, but when checking ~/.asdf/shims/which I saw the following:

image

asdf gives you the knowledge of which (no pun intended) node versions use this invalid "which".

In my case, nodejs 12.2.0 was the culprit, I removed it by issueing asdf uninstall nodejs 12.2.0 and then ran asdf reshim, afterwards I could use which normally once again.

To check out if it would re-appear when reinstalling 12.2.0 what I did was asdf install nodejs 12.2.0 followed by an asdf reshim. This time, I was able to keep using which normally as well.

So no need to remove all node versions and the asdf node plugin, just reinstall the offending node versions mentioned in ~/.asdf/shims/which and asdf reshim afterwards.

Weird stuff, easily fixed permanently though (fortunately). Hope this helps!

I couldn't get it working, but if you want desperately want to use which without needing to do anything, you can use /usr/bin/which something

Was this page helpful?
0 / 5 - 0 ratings

Related issues

robsonpeixoto picture robsonpeixoto  路  4Comments

gmile picture gmile  路  3Comments

Antiarchitect picture Antiarchitect  路  3Comments

jayvdb picture jayvdb  路  4Comments

jthegedus picture jthegedus  路  3Comments