0

I'm trying to docker up a laravel application with laravel sail, but I get the following error for the sail container:

/usr/bin/env: 'bash\r': No such file or directory

The error of this from what I read is caused only in windows because when cloning the project repository the option of core.autocrlf is true, but this option was set to false in all the git config of the system, but it keeps throwing the same error, even give up docker and the ubuntu virtual machine but it keeps throwing the same error. I enclose what the git config -l command throws:

file:C:/Program Files/Git/etc/gitconfig diff.astextplain.textconv=astextplain
file:C:/Program Files/Git/etc/gitconfig filter.lfs.clean=git-lfs clean -- %f
file:C:/Program Files/Git/etc/gitconfig filter.lfs.smudge=git-lfs smudge -- %f
file:C:/Program Files/Git/etc/gitconfig filter.lfs.process=git-lfs filter-process
file:C:/Program Files/Git/etc/gitconfig filter.lfs.required=true
file:C:/Program Files/Git/etc/gitconfig http.sslbackend=openssl
file:C:/Program Files/Git/etc/gitconfig http.sslcainfo=C:/Program Files/Git/mingw64/ssl/certs/ca-bundle.crt
file:C:/Program Files/Git/etc/gitconfig core.autocrlf=false
file:C:/Program Files/Git/etc/gitconfig core.fscache=true
file:C:/Program Files/Git/etc/gitconfig core.symlinks=true
file:C:/Program Files/Git/etc/gitconfig pull.rebase=false
file:C:/Program Files/Git/etc/gitconfig credential.helper=manager-core
file:C:/Program Files/Git/etc/gitconfig credential.https://dev.azure.com.usehttppath=true
file:C:/Program Files/Git/etc/gitconfig init.defaultbranch=master
file:C:/Users/hpbay/.gitconfig  core.editor="C:\Users\hpbay\AppData\Local\Programs\Microsoft VS Code\bin\code" --wait
file:C:/Users/hpbay/.gitconfig  core.autocrlf=false

I had this error on another machine and the solution was to set the core.autocrlf to false, but on this machine it performs many tests and the same error continues, does anyone have any idea what it could be besides the core.autocrlf? or at least see a more detailed error?

Tprogramer
  • 73
  • 1
  • 11
  • 1
    What more detailed error do you expect to see? The problem is that there is `\r` in your code. Run `dos2unix` on this file. – Arkadiusz Drabczyk Feb 08 '22 at 17:50
  • But what file, in /usr/bin/env? But if it is a file of the virtual machine, I do not understand that @ArkadiuszDrabczyk – Tprogramer Feb 08 '22 at 17:56
  • 1
    No, in shell script that your docker container calls that starts with `/usr/bin/env bash` – Arkadiusz Drabczyk Feb 08 '22 at 18:30
  • This is covered in [Are shell scripts sensitive to encoding and line endings?](https://stackoverflow.com/questions/39527571/are-shell-scripts-sensitive-to-encoding-and-line-endings) – Charles Duffy Feb 16 '22 at 20:49

1 Answers1

0

Run the dos2unix command which changed many project files and it worked there.

Tprogramer
  • 73
  • 1
  • 11
  • Duplicative questions should be closed, not answered, as per the _Answer Well-Asked Questions_ section of https://stackoverflow.com/help/how-to-ask. (As the author of this one, you're able to unilaterally delete it). – Charles Duffy Feb 16 '22 at 20:50
  • It won't let me delete the question as there are comments – Tprogramer Feb 17 '22 at 13:49