score:1

create-react-app listed all .env files which can used when run npm run build To change PORT in local production build you can create a file name .env.production.local and set the PORT you want:

##
HOST=127.0.0.1
PORT=5000
## PUBLIC_URL=http://myexamplesite.lk/
##

REACT_APP_ROOT_BASE_URL=https://myexamplesite.lk/api/
REACT_APP_ROOT_BASE_URL_META=http://myexamplesite.lk/

score:2

From react docs:

"the port can be adjusted using the -p or --port flags."

serve -p 7000 -s build

Related Query

More Query from same tag