I'm trying to build an app using Laravel 9 and ReactJS with vite js. I tried following command to build.
npm run dev
But I'm getting following errors,
GET http://[::1]:5173/resources/css/app.css net::ERR_CONNECTION_REFUSED
GET http://[::1]:5173/@vite/client net::ERR_CONNECTION_REFUSED
GET http://[::1]:5173/resources/js/app.jsx net::ERR_CONNECTION_REFUSED
GET http://[::1]:5173/@react-refresh net::ERR_CONNECTION_REFUSED
If you entered npm run build
on production, your .env
file looks good, and you still have such errors as the author – just delete the file public/hot
.
For those using Laravel Sail, open the vite.config.js
file and configure it like so:
export default defineConfig({
plugins: [
react(),
laravel({
input: ['resources/css/app.css', 'resources/js/app.js'],
refresh: true,
}),
],
server: {
hmr: {
host: 'localhost',
},
}
});
If need be, stop and restart the server sail npm run dev
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