问题
I'm seeing a bunch of questions around this error but no one seems to have an actual answer and none of the causes listed by the other posters apply to my case.
I've tracked it down to happening when I upload a particularly large file (50mb or more) from my server over to Amazon's S3. Somewhere in that process I get several hundred instances of
(node) warning: Recursive process.nextTick detected. This will break in the next version of node. Please use setImmediate for recursive deferral.
and then eventually a
var str = String(f).replace(formatRegExp, function(x) {
^
RangeError: Maximum call stack size exceeded
Curious if anyone else has seen this specific instance and managed to find a solution. I'll obviously post one as an answer if I figure it out.
回答1:
To actually fix this you must
- Identify the line of code that is causing this.
- search for
process.nextTickin both your code and your npm dependencies - OR If you can reproduce in the debugger and set a break point at the code in node core that throws that error, you may be able to look at the stack at that point and identify the root cause file/line.
- search for
- Change that code to use
setImmediateinstead- It is not necessarily your app code that is the root cause, so you may need to fork/PR a third party module
来源:https://stackoverflow.com/questions/32187065/is-there-a-way-to-avoid-this-error-node-warning-recursive-process-nexttick-d