简体   繁体   English

Laravel Sail - 在为 Windows10 WSL2 上的现有项目安装 laravel Sail 后,我不断收到 docker-composer 错误

[英]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.这在 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我有一个使用 laravel 帆的现有项目,该项目可以在我的 Mac 上运行,但是当我尝试使其在 windows 上运行时,正在运行现有项目Z5E056C500A1C4B6A7110B50D807BADEx5Z/salar#installing.com/docs-8/slaravel.com的安装。 现有项目的依赖项

I haven't found a solution adapted to laravel sail yet.我还没有找到适合 laravel 航行的解决方案。

./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

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 .实际上,在我找到解决方案的地方进行了讨论。

Explaination解释

So I've found the answer thanks to the Vaidotas answer.因此,由于 Vaidotas 的回答,我找到了答案。 It leads me to some leads.它引导我找到一些线索。

This bug is caused by the default mounting此错误是由默认挂载引起的

"mnt/c/..." “mnt/c/...”

The path needs to be路径必须是

"c/..." “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).通过将 c 更改为任何其他字母(在我的情况下为 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.然后您可以导航到刚刚创建的新文件夹。 在此处输入图像描述

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我在这个线程https://github.com/microsoft/WSL/issues/1918中找到了解决方案

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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