Create-react-app: Allow using a port other than 3000

Created on 27 Jul 2016  路  5Comments  路  Source: facebook/create-react-app

I tried a search for "port"-related issues but didn't find any, so I'll make this one.

It would be nice to be able to specify a port other than 3000, either as a command line parameter or an environment variable. Some environments (Cloud9) restrict the ports you can use.

Right now, the process is pretty involved:

  1. Run "npm run eject"
  2. Wait for that to finish
  3. Edit "scripts/start.js" and find/replace "3000" with whatever port you want to use
  4. Edit "config/webpack.config.dev.js" and do the same
  5. npm start

Most helpful comment

Awesome, thanks! PORT=xyz npm start is working in the alpha.

All 5 comments

It is discuss in #101 , and there is a relevant PR #243

Do you want to close this issue if your question has been addressed?

I'll close this, it looks like the discussion near the end of #102 is heading in this direction.

101 and #243 don't address quite the same question. I'm not wondering how to override the port when the port is in use, but how to choose a port other than 3000 from the get-go.

We default to PORT from environment now if it is specified. Please try the new alpha: https://github.com/facebookincubator/create-react-app/pull/190

Awesome, thanks! PORT=xyz npm start is working in the alpha.

Released as stable.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ap13p picture ap13p  路  3Comments

adrice727 picture adrice727  路  3Comments

oltsa picture oltsa  路  3Comments

fson picture fson  路  3Comments

AlexeyRyashencev picture AlexeyRyashencev  路  3Comments