问题
I tried to install laravel with this command on CMD;
curl -s https://laravel.build/example-app | bash
but I got this error
(23) Failed writing body
When I tried with PowerShell I got this error;
cmdlet Invoke-WebRequest at command pipeline position 1
Supply values for the following parameters:
Uri:
curl : Cannot find drive. A drive with the name 'https' does not exist.
At line:1 char:1
curl -s https://laravel.build/example-app | bash
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
CategoryInfo : ObjectNotFound: (https:String) [Invoke-WebRequest], DriveNotFoundException
FullyQualifiedErrorId : DriveNotFound,Microsoft.PowerShell.Commands.InvokeWebRequestCommand
Specs;
Docker Engine v20.10.0
Edition Windows 10 Home Version 20H2 Installed on 14/08/2020 OS build 19042.685 Experience Windows Feature Experience Pack 120.2212.551.0
回答1:
I ran into this issue as well and found the (usually excellent) Laravel documentation to be a little vague.
First of all, I have some knowledge of Docker but wanted to get much better acquainted so the recent release of Laravel Sail seemed like an excellent starting point.
- Install Docker Desktop https://docs.docker.com/docker-for-windows/install/
- Install and enable WSL2 https://docs.microsoft.com/en-us/windows/wsl/install-win10#simplified-installation-for-windows-insiders
- The Laravel docs mention this in above step but the part I missed was installing a Linux distribution at the same time (via the Microsoft Store). I assumed Sail took care of this part.
- Goto the windows store a get your distro e.g. Ubuntu 20.04 (https://www.microsoft.com/en-gb/p/ubuntu-2004-lts/9n6svws3rx71?rtc=1)
- Install Windows Terminal - https://www.microsoft.com/en-us/p/windows-terminal/9n0dx20hk701?rtc=1&activetab=pivot:overviewtab. Up until now, I was using Cmder or ConEmu rather than the Command Prompt. The important difference is you can start a new shell for windows or any of the Linux distributions you have installed. Again, I assumed you could use the
curl -s https://laravel.build/example-app | bash
command in my windows Cmder - not the case. - Start up a new Linux shell and if you
ls
you'll see your Windows filesystem. From there Icd
'd to my projects directory, rancurl -s https://laravel.build/example-app | bash
and that took care of the rest.
One caveat is that you may have to enable any downloaded Linux distributions in Docker:
Of course, the process makes sense when you solve it and Sail does offer some useful shortcuts in getting a Laravel project up and running quickly with Docker but complete newcomers could be forgiven for thinking it takes care of absolutely everything - which it doesn't.
Side note
The reason you were getting the error in PowerShell is because PS has an alias for curl
but not the curl you expect. (cURL in power shell windows 8.1: "A drive with the name 'localhost' does not exist")
You can permanently remove this (https://github.com/lukesampson/scoop/issues/56#issuecomment-609098474) but you may not need to now you know how to use the command in your Linux shell.
来源:https://stackoverflow.com/questions/65312815/laravel-installation-sail-problem-23-failed-writing-body