简体   繁体   中英

laravel/docker project env: bash\r: No such file or directory

I know, I know this question has been discussed a million times but please here me out. So I am brand new to using docker/sail with Laravel I am creating my first ever project with that. I have coded using Laravel for probably 8 years now and had always used WAMP. I am running Windows 11.

So to the problem when I try to start up my container using sail up or docker desktop I have 3 (not even sure I am using the correct terminology here) but I have 3 sections/services in my docker-compose.yml file. redis, mysql and laravel.test. The redis and mysql startup fine and show the green icon in docker desktop. But the laravel.test shows the following error in the log: /usr/bin/env: 'bash\r': No such file or directory

Now I have read 100 other threads discussing this and most all of them talk about the line endings and needing to switch to Unix line endings. So I have tried every thing in the books. I have removed the entire git repo, then ran git config --global core.autocrlf false then cloned the project again and I still get the same error. I then used my editor (phpStorm) and made sure the preferences were set to use unix line endings and then ran a script to change all the files with correct line ending. I still get the same error.

So my question is how can I dig deeper into Laravel/docker/sail and determine what is actually generating the error and how can I pinpoint the line causing the error? How can I determine what script/file is generating this error that is trying to find /usr/bin/env in the first place?

I am so lost as this is all so new to me.

Installing to the WSL VM Home

Following the Laravel documentation for installing laravel with Windows . Laravel should be installed from inside a new WSL terminal session with curl -s https://laravel.build/example-app | bash curl -s https://laravel.build/example-app | bash . This documentation hints that the project should be installed and located in the WSL VM home.

A similar question suggests running docker containers from within WSL by moving the project to the VM home. In many cases this is located \\wsl$\Ubuntu-20.04\home\username\project .

Sail Commands

The container may need to be rebuilt after the move. This can be accomplished with the sail build --no-cache command.

If no alias is set yet the sail commands may be accessed with vendor/bin/sail {command}

The following is a list of resources that can be used:

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM