Right now Mojito will report the following if the port is being used:
Can it report "Error: the port is already being used" instead? This is even more useful when we started the server on a Linux box remotely and ssh into that box and start the mojito app again and get this error and didn't know what was going on.
throw arguments; // Unhandled 'error' event
Error: listen EADDRINUSE
at errnoException (net.js:770:11)
at HTTPServer.Server._listen2 (net.js:910:14)
at listen (net.js:937:10)
at HTTPServer.Server.listen (net.js:986:5)
at MojitoServer.listen (/usr/local/lib/node_modules/mojito/lib/mojito.js:502:17)
at Object.exports.run (/usr/local/lib/node_modules/mojito/lib/app/commands/start.js:89:9)
at Function.CLI.run (/usr/local/lib/node_modules/mojito/lib/management/cli.js:176:17)
at Object.<anonymous> (/usr/local/lib/node_modules/mojito/bin/mojito:12:5)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
Good idea, but frankly Error: listen EADDRINUSE already says it all.
Error: listen EADDRINUSE
I see some application programmers asking the same questions else where what is about EADDRINUSE... but as of other things in life, maybe it is not about how clear things are. It is about how unclear things are, and then there can be power over the other people. Just like lawyers will publish some forms that they know have some loopholes. So if the landlord use that form, he will run into issues and not know how to handle. It is not until the landlord pays $160 / hour, then the landlord can get the "professional service".
Agreed. Let's have a better error message, e.g.
"Port already in use. Is another Mojito, or another program, already running on this port?"
What do you think? I wish I could tell users how to get rid of this error, but doing so is very OS-specific.
@isao can we solve this at the cli level? In production, in 0.6.x we don't want to have a fancy error, only when running thru mojito start, in which case I think this belongs to the cli.
@caridy yes, this should be handled by mojito-cli(-start). I'll migrate this issue once the org-repo is created
- fix requires/paths
- use mojito-cli api, env calcs, exports
- check is-an-app
- check app depends on mojito
- check mojito is installed or specified
- can specify --lib path/to/mojito
- do proper post-listen error handling
- check EADDRINUSE
- note these need yahoo/mojito#1150 to land, noop otherwise
- invoke cb when done
Hi @jianlin, @caridy, I put in a fix for this in mojito yahoo/mojito#1150
mojito-cli's start command takes advantage of that patch and this one to make a nicer "Port %d already in use." error.
Changes reflected in email@example.com (just released) and firstname.lastname@example.org (latter to be published very soon)