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
我现在在 windows wsl2 上发生过几次这种情况。
我有一个使用 laravel sail 的现有项目可以在我的 mac 上运行,但是当我尝试使其在 windows 运行 上运行时,现有项目的安装 https://laravel.com/docs/8.x/sail#installing-composer-dependencies-for-existing-projects
我还没有找到适合 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
我有完全相同的问题。我能够解决这个问题的唯一方法是重新启动我的电脑。
更新:
我通过关闭旧终端并打开新终端解决了我的问题。
在我找到 solution.
的地方实际上有一个关于它的讨论
说明
所以我找到了答案,感谢 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
我现在在 windows wsl2 上发生过几次这种情况。 我有一个使用 laravel sail 的现有项目可以在我的 mac 上运行,但是当我尝试使其在 windows 运行 上运行时,现有项目的安装 https://laravel.com/docs/8.x/sail#installing-composer-dependencies-for-existing-projects
我还没有找到适合 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
我有完全相同的问题。我能够解决这个问题的唯一方法是重新启动我的电脑。
更新:
我通过关闭旧终端并打开新终端解决了我的问题。
在我找到 solution.
的地方实际上有一个关于它的讨论说明
所以我找到了答案,感谢 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