Create-react-app: how change port

Created on 28 Nov 2017  路  8Comments  路  Source: facebook/create-react-app

how can i change port 3000 to 3001

Most helpful comment

In your console run PORT=3001 yarn start

All 8 comments

@Yonben Right, thanks

In your console run PORT=3001 yarn start

change port in console before running
SET PORT=3100

then run the command
npm start

On my pc:

E:\ReactJs\reactapp2>SET PORT=3100

E:\ReactJs\reactapp2>npm start

[email protected] start E:\ReactJs\reactapp2
react-scripts start

Compiled successfully!


i searching and reading number of comments..! this is so simple and successful

I documented the various options one can choose in order to change the default port. You can set the environment variable as shown in the comment above, change the start command, or create .env file. Here is the full article.

Windows users change the script like this:
"scripts": { "start": "set PORT=5000 && react-scripts start",

and Linux and Mac users like this:
"scripts": { "start": "PORT=5000 react-scripts start",

Was this page helpful?
0 / 5 - 0 ratings

Related issues

jantimon picture jantimon  路  154Comments

sgriffey picture sgriffey  路  113Comments

amuehl picture amuehl  路  79Comments

ericvicenti picture ericvicenti  路  83Comments

rovansteen picture rovansteen  路  192Comments