Artisan Error: Failed to listen on localhost:8000

by

I was creating an admin dashboard based on Laravel. UI components were reactive and build upon the vuejs framework. I will have a post on my experience with the vuejs framework someday.

I was switching between a compilation of Vue component changes and running the laravel localhost server. A regular serve command to start localhost:


php artisan serve —host 192.168.10.203 —port 8000

I was serving at the IP address of the machine so I could test conveniently from other machines and devices connected to LAN.

Between development precess somehow the laravel artisan process mustn’t have closed properly. When I attempted to serve localhost I received this error:


Failed to listen on localhost:8000(reason: Address already in use)

First thing I had to list the processes running in my system. At a given time, there are many different processes running. I will also need to filter the processes relevant to php


ps -ef | grep php

ps command will the processes.
-f is used to view extra full format
grep is to filter our result

Something below will appear:


501 1234 1229 0 11:51AM ttys004 0:00.57 php artisan serve —host 192.168.10.203 —port 8000



Our process id is 1234 here that is running our laravel localhost. We will kill this process using command:


kill <pid number>
kill 1234

It didn’t work. Next I tried was to force terminate the process.


Kill -9 1234

This worked.

You might also like: No Matching Distribution Found for Botocore: AWSEBCLI

More Articles

Recommended posts