skip to Main Content

I am not able to run many project in 3000 port at the same time.

How can I change react port for run multiple react project at the same time. Any solution for this problem?

Show this message:
Something is already running on port 3000.

2

Answers


  1. Try changing the "scripts" section in your package.json, in the "start" also set the environment variable PORT with a value different than 3000:

    ...
    "scripts": {
        "start": "set PORT=3500 && react-scripts start",
        "build": "react-scripts build",
        "test": "react-scripts test",
        "eject": "react-scripts eject"
      },
    ...
    
    Login or Signup to reply.
  2. If React app created with Vite, add port to server block in vite.config.js.

    import { defineConfig } from 'vite'
    import react from '@vitejs/plugin-react'
    
    export default defineConfig({
      plugins: [react()],
    
      server: {
        // change to desired port
        port: 3000
      }
    })
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search