ericclemmons / ericclemmons/grunt-express-server

initial server not closed

Open
#103 4 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
249
Forks
59
PR merge metrics
No merged PRs in 30d

Description

(alert: I'm new to grunt-express-server and many of the surrounding tools, so issue may be little more than my lack of understanding and/or out-of-date docs).

I started using grunt-express-server yesterday, replacing nodemon, because I wanted a toolchain where editing a source file would run my mocha tests and restart my dev server.

I discovered that, even though the tests ran and the server restarted; the server did not seem to be running my latest code. Much head-scratching later, I found that I had been bitten by two issues:

1) console.log and console.error messages were not appearing on my terminal, making it hard to see that the problem was that the new server instance had failed to fully start. Rather, it was dying because its port was in use. My guess is that this might be an artifact of the process dying without flushing console output. But, dunno. In any event, this is just a side-effect that made it harder to debug problem 2, the real issue.

2) My gruntfile was started with a task that did ['express:dev', 'watch]. Watch, in turn, listed express:dev as a task.

This did not work -- although I understood it to be what I should do, based on the docs I had read. When the node server was restarted, it did not kill the initial instance, so was not able to grab the port, so died. (and, making matters more confusing, was dying silently).

I fixed the problem by having my initial task just do ['watch'], and giving watch the option atBegin: true.
So, I think I'm ok now. Reporting this issue for the sake of improving docs for the next guy, or in the hope that I've revealed that I've done something stupid that I should fix.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.