Search code examples
laravelvue.jsremote-accesslaravel-artisan

How to run "php artisan serve" on local network


enter image description hereMe and a classmate are working on an online shop. We must share our progress and started using Dropbox but it was too slow. We tried connecting our PCs through a local network, he shared the project in a "Public Access" folder so I can read and edit files but when I run the php artisan serve command I have this message saying UNC routes are not supported. I have a similar problem with the npm run dev/watch because it searches for a file in "C:" but I'm not on C:

I tried changing the command to php artisan serve --host 0.0.0.0 --port 80 and also changing the host and port as well but it didn't worked. Also tried to run both commands on PowerShell, I read that it support UNC routes but it threw the same error. I'm desperate 'cause it's been like 4 hours and the Dropbox files aren't ready. About the npm problem I didn't find a useful answer. Sorry for the bad english


Solution

  • for windows

    php artisan serve --host your-ip-add --port 8000
    

    e.g

    php artisan serve --host 192.168.1.001 --port 8000
    

    For linux use

    sudo before command

    and try to be on same network