'How to get asdf's version to be the version

Explained in terminal, I have installed a version of nodejs using asdf, but the terminal only sees the other version:

> asdf list
nodejs
  12.18.3

> nodejs --version
v8.10.0

> asdf global nodejs 12.18.3 

> nodejs --version          
v8.10.0

Have added the following to the top of .zshrc

. $HOME/.asdf/asdf.sh
export PATH=$HOME/.asdf/asdf.sh:$PATH

Have reloaded .zshrc

> source ~/.zshrc

There are no local files which are setting the local version to 8.10.0.

How do I get nodejs --version to give me the version that asdf acknowledges as the global version?



Solution 1:[1]

I'm having the same issue, and I noticed that it seems to happen because asdf doesn't seem to know about a version of Ruby (2.6.3) I installed via asdf today. It recommends I use one of my three previous versions of Ruby:

james@James-Precision-5520:~/Git/elixirschool$ asdf current elixir 1.9.0-otp-22 (set by /home/james/.tool-versions) erlang 22.0.7 (set by /home/james/.tool-versions) ruby 2.6.3 (set by /home/james/.tool-versions) james@James-Precision-5520:~/Git/elixirschool$ jekyll asdf: No version set for command jekyll you might want to add one of the following in your .tool-versions file:

ruby 2.3.7 ruby 2.4.3 ruby 2.5.1 james@James-Precision-5520:~/Git/elixirschool$ ls ~/.asdf/installs/ruby 2.3.7 2.4.3 2.5.1 2.6.3 james@James-Precision-5520:~/Git/elixirschool$ asdf list ruby 2.3.7 2.4.3 2.5.1 2.6.3 When I changed my .tool-versions to point at one of the other three (older) Ruby installs, it started working.

Solution 2:[2]

If you want to install asdf with homebrew use this:

echo -e "\n. $(brew --prefix asdf)/libexec/asdf.sh" >> ${ZDOTDIR:-~}/.zshrc

This adds the asdf.sh properly to the .zshrc file.

Read about it here

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 MOHIT TEVATIA
Solution 2 Jason Cheladyn