I started having an issue starting from today when running npm run dev when running php artisan serve --host=IP using vite + laravel (i'm using breeze boilerplate as a starter).
Basically, it was working just fine for over a month until today, i started having the error ERR_CONNECTION_REFUSED [::1]:5173.
I tried changing the server in vite.config.js as follows:
export default defineConfig({
server: {
host: "0.0.0.0",
port: 5173,
hmr: {
host: "127.0.0.1",
},
},
...
The only ways i can make it work is either by running npm run build or by manually putting the server on the vite.config.js
export default defineConfig({
server: {
host: "192.168.31.166",
port: 5173,
hmr: {
host: "192.168.31.166",
},
},
...
I do not want to have to change the server manually every time, as i don't have a fixed IP Address and use 2 different wifi configurations based on if I'm at work or working remotely.
Did anyone face those issues? I tried running npm update and composer update so i'm on latest versions for Laravel (10.8.0) and Vite (4.3.1), it didn't fix it.
Thank you in advance!
TL;DR: Tried running
npm run devandphp artisan serve --host=IPand got an ERR_CONNECTION_REFUSED instead of the normal behaviour (was working just fine before)
Seems you have run npm run dev before and the public/hot file wasn't destroyed when you stopped running it. Removing the hot file should solve your issue.
answer from laracast
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With