skip to Main Content

I am having an issue with Vite that I have never seen before and need some help.

I have a project with two folders, Backend and Frontend, Backend folder works fine, the problem is with the Frontend folder.

I have Vite with React and Tailwind and I have configured the Frontend project for Docker, to be able to create an image and I have done it correctly, it works, the problem that I have now is when I try to run the Frontend project on my laptop, I can not, it automatically stops.

Here is an image to explain it:

enter image description here

The problem is when I type npm run dev is automatically killed, but I do not know why.
I checked my ram and CPU and is only at 40% of usage, I also restart my computer.

Here is my vite.config.js file

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

export default defineConfig({
  plugins: [react()],
  server: {
     host: '0.0.0.0',
     port: 3000,
  },
  assetsInclude: ['**/*.html']
})

Does anyone have an idea what could happen?

2

Answers


  1. Chosen as BEST ANSWER

    Okay, after one day of trying I have discovered the solution.

    I do not remember when or why but I needed to run two commands as 'sudo' to integrate Vite server with Docker and, one of that, was sudo npm install to update some packages, so, after that, to run vite again I ONLY need to do sudo npm run dev. That's all.

    Thank a lot to all and sorry to bother you.


  2. Try with these configs

     host: true,
     port: 8000,
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search