sebastianswms / cs4900

Senior design project.
1 stars 1 forks source link

local port 3000 already used #26

Closed Hoken8 closed 5 months ago

Hoken8 commented 5 months ago

If the user is using port 3000, the React SPA will not work and in the Electron main.js file will not find the content for the application.

Suggested changes: change the port in window.loadURL() to a variable in the config file and change the start script and the build script, in the package-lock file to reference that port number.

temp fix :

code/scouting-hub/electron/main.js

line: 21 change port to 3006

  window.loadURL(
    isDev
      ? "http://localhost:3006"
      : `file://${path.join(__dirname, "../build/index.html")}`
  );

code/scouting-hub/src/package.json line: 21 add cross-env PORT=3006 line: 26 change to 3006

  "scripts": {
    "start": "cross-env PORT=3006 react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject",
    "dev": "concurrently -k \"cross-env BROWSER=none npm start\" \"npm:electron\"",
    "electron": "wait-on tcp:3006 && electron ."
  },