Skip to content
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

Change default port behavior #353

Closed
ThomasG77 opened this issue Dec 24, 2017 · 6 comments
Closed

Change default port behavior #353

ThomasG77 opened this issue Dec 24, 2017 · 6 comments
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: claimed Issue has been claimed by a contributor who plans to work on it.

Comments

@ThomasG77
Copy link
Contributor

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

  • Ubuntu 16.04 64 bits
  • Node 8.4.0
  • npm 5.6.0

Steps to Reproduce

When I run npm run start from step 4 of https://docusaurus.io/docs/en/site-preparation.html#verifying-installation, I encounter following message (as I have another server running on 3000)

Checking if port 3000 is free...
Port 3000 is in use

I tried to do PORT=3001 npm run start and it fails.

I've seen that I can set port using --port 3001 at https://github.com/facebook/Docusaurus/blob/master/lib/start-server.js#L34

Expected Behavior

I would expect that if port 3000 is not available, it would automatically switch to PORT number + 1 (like http-server does)
I would also expect PORT=3001 npm run start should not fail.

Actual Behavior

The command line does not switch port automatically
Environment variable PORT is not supported but it should IMO as I consider that it's default setting in most Node projects.

@richardzcode
Copy link
Contributor

@ThomasG77 it is because you are adding parameter to npm not its script docusaurus-start

To let npm pass arguments to script, you'll need to add a -- in between.

Like this: npm run start -- --port 3001

@ThomasG77
Copy link
Contributor Author

ThomasG77 commented Dec 24, 2017

Thanks @richardzcode for the answer but it's not the issue: I already mentioned your solution in the issue description.

I do not care about option --port 3001. I just want the usual environment variable with PORT=3001.
It don't want it to be a replacement just an alternative as on every project I use and see in the Node landscape, changing port is about PORT=3001 node myservercode.js

@neilsutcliffe
Copy link
Contributor

Is this generally what people expect to happen. Does create-react-app fall-up to 3001 when 3000 is used?

@ThomasG77
Copy link
Contributor Author

ThomasG77 commented Dec 28, 2017

@JoelMarcey JoelMarcey added the feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. label Feb 27, 2018
@JoelMarcey
Copy link
Contributor

@ThomasG77 Hi. I think this is more a feature request than a bug since you can accomplish the same thing with the command line option. But I see your point in allowing an environment variable as well.

@yangshun
Copy link
Contributor

yangshun commented Apr 11, 2018

Closed in #516 , thanks @InternetExplorer7 for the feature!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This is not a bug or issue with Docusausus, per se. It is a feature request for the future. status: claimed Issue has been claimed by a contributor who plans to work on it.
Projects
None yet
Development

No branches or pull requests

5 participants