1
/usr/local/lib/node/.npm/mongoose/0.0.5/package/lib/util.js:40
          continue;
         ^^^^^^^^
node.js:68
      throw e; // process.nextTick error, or 'error' event on first tick
      ^
SyntaxError: Illegal continue statement
    at Module._compile (node.js:418:29)
    at Object..js (node.js:429:14)
    at Module.load (node.js:355:35)
    at Function._load (node.js:322:14)
    at require (node.js:367:23)
    at Object.<anonymous> (/usr/local/lib/node/.npm/mongoose/0.0.5/package/lib/model.js:2:13)
    at Module._compile (node.js:423:30)
    at Object..js (node.js:429:14)
    at Module.load (node.js:355:35)
    at Function._load (node.js:322:14)

And the code is just:

var mongoose = require('mongoose').Mongoose;

mongoose.model('User', {
    properties: ['user', 'pass', 'widgets' ],
    indexes: [ { 'user' : 1 } , { unique : true }  ],
});
.......

/usr/local/lib/node/.npm/mongoose/0.0.5/package/lib/util.js:40

 else {
       // Prevent never-ending loop
       if (target === d.value) {
             continue;
       }

even if i comment the continue statement, causes another error log:

node.js:68
      throw e; // process.nextTick error, or 'error' event on first tick
      ^
Error: ECONNREFUSED, Connection refused
    at Socket._onConnect (net.js:548:18)
    at IOWatcher.onWritable [as callback] (net.js:165:12)

Any idea?

1
  • It might help to post more of the code - I can't tell what the context of the continue and if statement is. The connection refused is possibly because without your continue you are sending it into an infinite loop and burning through your connections. Jan 21, 2011 at 1:10

2 Answers 2

3

/usr/local/lib/node/.npm/mongoose/0.0.5/package/lib/util.js

Edit this file and change line 40 from continue; to return;

In Array.prototype.forEach, continue is not supported (you can use the example below to test return vs continue in firebug's console)

[1,2,3,4].forEach(function(val, arr) {
  if(val != 1) {
    console.log(val);
    return;
    //continue;
  }

  console.log('here');
});
1
  • not sure I'd change continue for a return, might preserve the behaviour better if everything after the continue were just commented out and everything after the if statement were put into the else clause:
    – Jim T
    Jan 23, 2011 at 20:51
1

ECONNREFUSED is because your mongod is not running - where's the connect string?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.