0

I'm trying to install asdf on Debian 11. After install, I still get this error:

bash: asdf: command not found

Suspect: I'm sourcing something incorrectly.

Here's the script I'm using to install with:

#!/bin/bash

# Install prerequisites
sudo apt-get update
sudo apt-get install -y curl git

export https_proxy=127.0.0.1:8082

    # Install asdf
    git clone https://github.com/asdf-vm/asdf.git ~/.asdf --branch v0.11.3
    
    # Add asdf to the bash shell
    echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bashrc
    echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bashrc
    
    # Add asdf to the git shell
    echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.gitbashrc
    echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.gitbashrc
    
    # Activate asdf in the current shell
    source ~/.bashrc
    source ~/.gitbashrc

I've tried adding manually to .bashrc & .gitbashrc. Here's what .bashrc & .gitbashrc look like:

.bashrc

export PATH="$PATH:$HOME/.asdf/bin"
. "$HOME/.asdf/asdf.sh"
. "$HOME/.asdf/completions/asdf.bash"

.gitbashrc

export PATH="$PATH:$HOME/.asdf/bin"
. "$HOME/.asdf/asdf.sh"
. "$HOME/.asdf/completions/asdf.bash"

I've tried with and without the export path command.

I've reloaded the terminal, but every time I try to call asdf I get something like this:

user@user:~$ asdf plugin add erlang https://github.com/asdf-vm/asdf-erlang.git
bash: asdf: command not found

/.asdf folder exists and has the files in it. For some reason the shell just isn't finding it. Any ideas?

Emily
  • 2,129
  • 3
  • 18
  • 43

1 Answers1

0

First of all, I would recommend removing the path-prepending you do:

export PATH="$PATH:$HOME/.asdf/bin"

In the case of asdf, it doesn't do anything because no executables are located in ~/.asdf/bin. When you source ~/.asdf/asdf.sh, it already prepends the necessary stuff to the path.

To debug this, I would recommend trying the following

  • Run set -x in any scripts or interactively before sourcing ~/.asdf/asdf.sh to ensure it is actually doing so
  • Make sure that you are running bash and not dash (in the case of dash, the ~/.profile file is read instead of ~/.bashrc

Besides these tips, there isn't anything much I can do because it seems like some setup issue on your specific computer.

hyperupcall
  • 869
  • 10
  • 21