wsl-2ddev

WSL2 with Docker Desktop: ddev.exe not found in $PATH, please install it on Windows side;


I am trying to start a ddev environment using the command ddev start, but I keep getting the error message ddev.exe not found in $PATH please install it on Windows side; err=exec: "ddev.exe": executable file not found in $PATH. I followed the installation instructions on ddev website. However, the error still persists.

This is the full output of ddev debug test:

https://gist.github.com/webseppel/a2c8b4133f14b83fde05b0b8d2972f28

On Windows side:

ddev -v
ddev version v1.21.6

docker version
Client:
 Cloud integration: v1.0.33
 Version:           24.0.2
 API version:       1.43
 Go version:        go1.20.4
 Git commit:        cb74dfc
 Built:             Thu May 25 21:53:15 2023
 OS/Arch:           windows/amd64
 Context:           default

Server: Docker Desktop 4.20.1 (110738)
 Engine:
  Version:          24.0.2
  API version:      1.43 (minimum version 1.12)
  Go version:       go1.20.4
  Git commit:       659604f
  Built:            Thu May 25 21:52:17 2023
  OS/Arch:          linux/amd64
  Experimental:     true
 containerd:
  Version:          1.6.21
  GitCommit:        3dce8eb055cbb6872793272b4f20ed16117344f8
 runc:
  Version:          1.1.7
  GitCommit:        v1.1.7-0-g860f061
 docker-init:
  Version:          0.19.0
  GitCommit:        de40ad0

In WSL2:

ddev -v
ddev version v1.21.6

Solution

  • Welcome to DDEV @Seppel.

    There are a couple of problems here.

    You seem to be installing DDEV for WSL2 with Docker Desktop, which is great.

    1. Normally, ddev.exe on the Windows side is not used for a normal project, (one that uses *.ddev.site) because the hosts file does not need to be edited. If you're doing a project that doesn't have a changed project_tld or additional_fqdns then this should never come into play. It does come into play with some people who have Fritzbox routers or otherwise can't resolve *.ddev.site. You can read about this at https://ddev.readthedocs.io/en/latest/users/usage/troubleshooting/#ddev-starts-but-browser-cant-access-url
    2. But assuming that the hosts file does need to be edited, you need DDEV installed and in your PATH on the Windows side. Right now it's not in your PATH. Perhaps the Chocolatey installation failed, or perhaps you needed to reboot after installation. But you can, as admin user choco install -y ddev to install it, or use the installer from the releases page.

    When you can type ddev.exe --version on your PowerShell or Cmd or Git Bash window on the Windows side and not get an error, you're probably there.

    But I see you were already able to do that.

    So... Perhaps your WSL2 Distro is not set up with the path correctly. You should be able to type ddev.exe --version in WSL2 and get it to work. If it doesn't your PATH in there may not be right. On an example WSL2/Docker Desktop setup I see this:

    $ echo $PATH /usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/Git/bin:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/ProgramData/chocolatey/bin:/mnt/c/Users/testbot/AppData/Local/Microsoft/WindowsApps:/mnt/c/WINDOWS/system32:/mnt/c/WINDOWS:/mnt/c/WINDOWS/System32/Wbem:/mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/:/mnt/c/WINDOWS/System32/OpenSSH/:/mnt/c/Program Files/DDEV:/Docker/host/bin:/mnt/c/Users/testbot/AppData/Roaming/Composer/vendor/bin:/mnt/c/Users/testbot/go/bin:/mnt/c/Users/testbot/AppData/Roaming/npm:/snap/bin:/home/linuxbrew/.linuxbrew/bin

    The key thing there is /mnt/c/Program Files/DDEV - that element in the PATH lets you find ddev.exe from WSL2. You can add it manually to your .profile or .bash_profile or whatever, but it would normally be inherited by WSL2 from Windows setup.