Skip to content

Loading…

Nodemon doesn't like clustering with CoffeeScript #229

Open
MariusStuparu opened this Issue · 3 comments

2 participants

@MariusStuparu

Hi,

Last week I was getting ENOENT exceptions from Nodemon when trying to cluster.fork() my app. But this was happening only when running the CoffeeScript entry file, compiling it to vanilla JS is OK and running. Maybe it has something to do with my Windows PC, maybe not, I can't figure it out.

CoffeeScript module is installed, other scripts work, and it also runs fine without clustering.

Edit: seems to be in the same line with issue #214

Here's the pretty simple Compound.JS startup script:

#!/usr/bin/env node

app = module.exports = getServerInstance = (params) ->
    params = params || {}
    params.root = params.root || __dirname;
    return require('compound').createServer(params);

cluster = require('cluster')
osData = require('os')
numCPUs = osData.cpus().length

if !module.parent
  port = process.env.PORT || 3000
  host = process.env.HOST || '0.0.0.0'

  server = app();

  if cluster.isMaster
    cluster.fork() for i in [0...numCPUs] by 1

    cluster.on('exit', (worker, code, signal) ->
      console.log 'Worker %d died with code %d', worker.process.pid, code
    )
  else
      server.listen(port, host, () ->
      console.log 'Worker %d listening on %s:%d within %s environment', cluster.worker.id, host, port, server.set('env')
    );
@remy
Owner

Do you mind if I mark this a closed as a dupe, and focus on the other issue that's opened?

@MariusStuparu

If it's the same issue (I see the errors are different), then it's ok to close.

@remy
Owner

Is this still an issue (we're on nodemon@1.0.12 now)? I couldn't tell if there really was overlap with the referenced issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.