asdf current shows node, but zsh can't find node command

260 Views Asked by At

I am new to asdf. I installed asdf on via brew and enabled the asdf plugin in oh-my-zsh. Then I installed nodejs by asdf plugin add node and asdf install node, my .asdf current returns this

$ asdf current
nodejs          21.6.1          /Users/gefei/.tool-versions

But when I then do node, I just got an error:

$ node
zsh: command not found: node

What's going wrong?

EDIT: asdf reshim does not help, but asdf exec node works.

PS: I am sorry for the title, but I just could not find a good title which meets the quality standards of SE. For any advice I would be grateful

1

There are 1 best solutions below

0
gefei On

I spent about 40 minutes on this, and finally found a simple solution: I simply added the path /Users/gefei/.asdf/shims/ to my $PATH$ and then it works fine.

I actually don't know whose job it is to put a line to .zshrc to automate this, so I decided to write an answer to this question, hoping someone will find it helpful.