Laravel Sail, WSL & Docker /usr/bin/env: 'bash\r': No such file or directory

Laravel Sail, WSL & Docker /usr/bin/env: 'bash\r': No such file or directory

Received an error in docker. /usr/bin/env: 'bash\r': No such file or directory

It is happening due to windows line endings. To fix the issue follow below steps

 

For MAC:

brew install dos2unix # Installs dos2unix Mac

find . -type f -exec dos2unix {} \; # recursively removes windows related stuff

For Linux:

sudo apt-get install -y dos2unix # Installs dos2unix Linux

sudo find . -type f -exec dos2unix {} \; # recursively removes windows related stuff

And make sure your git config is set as follows:

git config --global core.autocrlf input

 

input makes sure to convert CRLF to LF when writing to the object database

Categories: Category 1