recursionprocess.nextTick警告

作为我的应用程序的一部分,我有以下几行代码:

process.nextTick(function() { // pre-populate cache with all users console.log('scanning users table in order to pre-populate cache'); tables.users.scan(function(err, users) { if (err) { console.error('unable to scan users database in order to pre-populate cache'); return; } console.log('found %d users in database', users.length); }); }); 

在Ubuntu下运行应用程序给我

 (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral. RangeError: Maximum call stack size exceeded 

在OSX上运行是没有任何警告的。

两者都运行相同的节点版本v0.10.24

删除这段代码解决了这个问题。 我正在试图弄清楚这里发生了什么。

尝试使用--trace-deprecation标志显示来运行节点

 Trace: (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral. at maxTickWarn (node.js:377:17) at process.nextTick (node.js:480:9) at onwrite (_stream_writable.js:260:15) at WritableState.onwrite (_stream_writable.js:97:5) at WriteStream.Socket._write (net.js:651:5) at doWrite (_stream_writable.js:221:10) at writeOrBuffer (_stream_writable.js:211:5) at WriteStream.Writable.write (_stream_writable.js:180:11) at WriteStream.Socket.write (net.js:613:40) at Console.warn (console.js:61:16) at Console.trace (console.js:95:8) at maxTickWarn (node.js:377:17) 

用 – --throw-deprecation运行给出

 Error: (node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral. at maxTickWarn (node.js:375:15) at process.nextTick (node.js:480:9) at Cursor.each (/var/www/node_modules/mongojs/node_modules/mongodb/lib/mongodb/cursor.js:184:13) at /var/www/node_modules/mongojs/node_modules/mongodb/lib/mongodb/cursor.js:191:16 at Cursor.nextObject (/var/www/node_modules/mongojs/node_modules/mongodb/lib/mongodb/cursor.js:540:5) at /var/www/node_modules/mongojs/node_modules/mongodb/lib/mongodb/cursor.js:187:12 at process._tickCallback (node.js:415:13) 

任何帮助非常感谢。

10倍

事实certificate,问题出现在我的应用程序mongojs中的一个模块中。 问题在模块的更高版本中解决,我只需要更新我的package.json

贾米斯·查尔斯评论关于运行我的应用程序与node --throw-deprecation app.js (或--trace-deprecation )向我显示了错误的堆栈跟踪,导致我的罪魁祸首模块。

我仍然不确定为什么这个问题显示在Ubuntu中,而不是我的MBA …