运行 app.js 时 Nodejs-mongoose-0.0.5 错误
/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)
代码只是:
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;
}
即使我注释 continue 语句,也会导致另一个错误日志:
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)
知道吗?
/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?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
/usr/local/lib/node/.npm/mongoose/0.0.5/package/lib/util.js
编辑此文件并将第 40 行更改为 continue;返回;
在 Array.prototype.forEach 中,不支持 continue(您可以使用下面的示例在 firebug 的控制台中测试 return 与 continue)
/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)
ECONNREFUSED 是因为你的 mongod 没有运行 - 连接字符串在哪里?
ECONNREFUSED is because your mongod is not running - where's the connect string?