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
CodePudding user response:
Same problem here but for me is working fine in local but when I try to place the code in a public server I got those errors
CodePudding user response:
Local is working fine for me, try adding this to vite.config.js file:
server: { cors: false },
or (try adding and mixing all values)
server: { https: false, cors: false, hmr: false, port: 8000 },
Worked for me when building to prod using npm run build
(with vue btw).
Add this to your .env file if you still have problems with the port.
ASSET_URL=http://yoururl:port