10

Can somebody explain how to run my reactJS app on port 80, without specifying port

currently it works on www.mydomain.com:3001 but I want it to be visible when I go to www.mydomain.com

I can't find the solution on create-react-app docs website so I'm asking here.

If I run application with

sudo npm start

I get error that something is already using port 80 (I did specify PORT= 80)

Thanks

ii7scw
  • 351
  • 1
  • 3
  • 17
  • 2
    By default `npm` does not have `root` privilege. That means, If you try to run any application which uses port below than `1024` port, you need a `sudo` access. If that is the case, you can run your `create-react-app` with `sudo PORT=80 npm start`. That should do the job. Hope this helps – Prakash Kandel Feb 13 '18 at 08:59

1 Answers1

8

you have to specify PORT env variable to run on port 80 PORT=80 npm run start

habibi07
  • 184
  • 9