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

npm run start should handle the port being in use #658

Closed
maribethb opened this issue Apr 7, 2021 · 2 comments · Fixed by #1182
Closed

npm run start should handle the port being in use #658

maribethb opened this issue Apr 7, 2021 · 2 comments · Fixed by #1182
Labels
category: plugin Anything in the plugins folder type: bug Something isn't working

Comments

@maribethb
Copy link
Contributor

maribethb commented Apr 7, 2021

Category

Scripts

Component

blockly-scripts start

Describe the bug

npm run start is configured to use port 3000 to run a plugin test page. If you already have another plugin open, or any other process listening on that port, the script silently fails. The symptom is no meaningful error message but Chrome does not launch as expected.

To Reproduce

npm run start on a plugin, leave it open
npm run start in another tab
Chrome does not open for the second one, no error

Expected behavior

Preferred: The script chooses an available port dynamically
Acceptable: An error message saying the port is in use.

Additional context

If you think this is happening to you (ie Chrome won't open and you don't know why), you can try
lsof -i :3000
If there is any output with a pid, that means there is a process using port 3000 already, and start script will fail.
kill 12345 where 12345 = the pid from the command above. This should kill the process and free up the port.

@maribethb maribethb added type: bug Something isn't working triage labels Apr 7, 2021
@moniika moniika added category: plugin Anything in the plugins folder and removed triage labels Apr 7, 2021
@maribethb
Copy link
Contributor Author

maribethb commented Apr 7, 2021

It looks like if we just didn't specify a port number, webpack-dev-server would find one for us. webpack/webpack-dev-server#685

better example here: webpack/webpack-dev-server#1054

@samelhusseini
Copy link
Contributor

Worth considering using https://www.npmjs.com/package/detect-port-alt to detect if the port is in use, and to offer an alternate port.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category: plugin Anything in the plugins folder type: bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants