Domanda

/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)

E il codice è solo:

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;
       }

anche se io commento l'istruzione continue, fa sì che un altro ceppo di errore:

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)

Qualche idea?

È stato utile?

Soluzione

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

Modifica questo file e cambiare la linea 40 da continuare; al ritorno;

In Array.prototype.forEach, continuare non è supportato (è possibile utilizzare l'esempio di seguito per il ritorno di prova vs continuare a console di Firebug)

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

  console.log('here');
});

Altri suggerimenti

ECONNREFUSED è perché il vostro mongod non è in esecuzione -? Dov'è la stringa di connessione

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top