-
-
Notifications
You must be signed in to change notification settings - Fork 26.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Option to specify port when running the server? #1083
Comments
You can specify your port with process.env.PORT. It can be done by changing the script for start in package.json as shown below: "start": "PORT=3006 react-scripts start" |
You mean my package.json will be
then npm start? didn't work for me (windows and ubuntu) |
@fireflieslive no it is not. You should change the |
haha, where am i looking. thanks! |
You're welcome. If your issue is solved you can close the issue :D |
works with ubuntu, not with windows:
|
The above command is Unix (Ubuntu, Mac, etc…). In windows enviroment, you need a different syntax. Google something like "set env in windows command line" |
For windows you can use cross-env https://www.npmjs.com/package/cross-env |
You can also create an
and save it in your project directory. |
This worked for me on elementaryOS, thanks! |
On Windows with yarn this worked for me:
|
Or use npm cross-env (without &&!)
|
how to do it with the build folder ? |
Deployment is a bit different, you can read our documentation on that @webmobiles. |
"start": "PORT=3006 react-scripts start" |
My project is based on create-react-app. npm start by default will run the application on port 3000 and there is no option of specifying a port in the package.json.
How can I specify a port of my choice in this case? I want to run two of this project simultaneously (for testing), one in port 3005 and other is 3006
SO Question
The text was updated successfully, but these errors were encountered: