1

这在 Windows wsl2 上发生了几次。我有一个使用 laravel Sai 的现有项目,它可以在我的 Mac 上运行,但是当我尝试让它在运行现有项目安装的 Windows 上运行时https://laravel.com/docs/8.x/sail#installing-composer-现有项目的依赖项

我还没有找到适合 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
4

2 回答 2

2

我有完全相同的问题。我能够解决这个问题的唯一方法是重新启动我的电脑。

更新:

我通过关闭旧终端并打开新终端解决了我的问题。

实际上,在我找到解决方案的地方进行了讨论。

于 2021-05-05T08:53:16.600 回答
1

解释

因此,由于 Vaidotas 的回答,我找到了答案。它引导我找到一些线索。

此错误是由默认挂载引起的

“mnt/c/...”

路径必须是

“C/...”


要解决这个问题

您需要创建一个新文件夹并将其安装到其他位置。

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

通过将 c 更改为任何其他字母(在我的情况下为 e),它也可以与其他目录一起使用。

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

然后您可以导航到刚刚创建的新文件夹。 在此处输入图像描述

然后您可以导航到您的项目文件夹,输入创建的文件夹...

我在这个线程中找到了解决方案 https://github.com/microsoft/WSL/issues/1918

于 2021-05-06T00:56:37.650 回答