Dave Beauchesne
Dave Beauchesne

Reputation: 111

Laravel Sail - After installing laravel sail for an existing project on Windows10 WSL2 I keep getting a docker-composer error

This happened to me a couple of times now on windows wsl2. I have an existing project using laravel sail that works on my mac but when I try to make it work on windows running the installation for an existing project https://laravel.com/docs/8.x/sail#installing-composer-dependencies-for-existing-projects

I haven't found a solution adapted to laravel sail yet.

./vendor/bin/sail up -d
Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 80, in main
  File "compose/cli/main.py", line 189, in perform_command
  File "compose/cli/command.py", line 70, in project_from_options
  File "compose/cli/command.py", line 146, in get_project
  File "compose/cli/command.py", line 206, in get_project_name
  File "posixpath.py", line 383, in abspath
FileNotFoundError: [Errno 2] No such file or directory
[6920] Failed to execute script docker-compose
Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 80, in main
  File "compose/cli/main.py", line 189, in perform_command
  File "compose/cli/command.py", line 70, in project_from_options
  File "compose/cli/command.py", line 146, in get_project
  File "compose/cli/command.py", line 206, in get_project_name
  File "posixpath.py", line 383, in abspath
FileNotFoundError: [Errno 2] No such file or directory
[6923] Failed to execute script docker-compose
Traceback (most recent call last):
  File "docker-compose", line 3, in <module>
  File "compose/cli/main.py", line 80, in main
  File "compose/cli/main.py", line 189, in perform_command
  File "compose/cli/command.py", line 70, in project_from_options
  File "compose/cli/command.py", line 146, in get_project
  File "compose/cli/command.py", line 206, in get_project_name
  File "posixpath.py", line 383, in abspath
FileNotFoundError: [Errno 2] No such file or directory
[6925] Failed to execute script docker-compose

Upvotes: 1

Views: 2408

Answers (2)

Vaidotas Lipskas
Vaidotas Lipskas

Reputation: 49

I have exact same issue. The only way Im able to solve this is by restarting my pc.

Update:

I solved my problem by closing old terminal and opening new one.

There is actually a discussion going about it where I found my solution.

Upvotes: 2

Dave Beauchesne
Dave Beauchesne

Reputation: 111

Explaination

So I've found the answer thanks to the Vaidotas answer. It leads me to some leads.

This bug is caused by the default mounting

"mnt/c/..."

The path needs to be

"c/..."


To fix it

You need to create a new folder and mount it to something else.

sudo mkdir -p /c 
sudo sh -c "echo '/mnt/c /c none bind' >> /etc/fstab"
sudo mount -a

It also works with other dir by changing the c to any other letter (in my case e).

sudo mkdir -p /e 
sudo sh -c "echo '/mnt/e /e none bind' >> /etc/fstab"
sudo mount -a

Then you can navigate to the new folder you just created. enter image description here

Then you can navigate to your project folder entering the created folder...

I've found the solution in this thread https://github.com/microsoft/WSL/issues/1918

Upvotes: 1

Related Questions