reactjsnpmnpm-start

npm start only opens on port 3000 when package.json specifies different port


I have a react project that has multiple build scripts that work on windows machines but on my mac when I run npm start it ignores the package.json and opens on port 3000.

"start": "set PORT=3050 && cross-env CLIENT_ENV=development craco start",

Has anyone experienced this before?


Solution

  • For mac and linux instead of set you need to use export.

    Using cross-env is probably your best solution in your case, something like

    "start": "cross-env PORT=3050 && cross-env CLIENT_ENV=development craco start"