node.jsoh-my-zshasdf

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


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


Solution

  • Alternatively, this line on your .zshrc file should solves as well:

    . /opt/homebrew/opt/asdf/libexec/asdf.sh
    

    Basically this add necessary content on your $PATH.