最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - warning: Recursive process.nextTick detected - Stack Overflow

programmeradmin0浏览0评论

I have application, that I'm starting to work with, I'm just want to run it, but it crash. It use grunt, that run node server, it's Angular.js application. When I'm running grunt task that run the server and when I try to access the app from the browser, I've got warnings from grunt or node:

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

lot of lines and finaly:

util.js:35
  var str = String(f).replace(formatRegExp, function(x) {
                      ^
RangeError: Maximum call stack size exceeded Use --force to continue.

    Aborted due to warnings.

I've try to search in my application for for process.nextTick but it's in lot of places in node_modules directory, and not in src.

Is it possilbe to remove that warning so I can run the application? What code should I search for this recursive call?

UPDATE

I use ack and found that this line came from this file in 3 places:

$REPO/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/‌​readable- stream/node_modules/core-util-is/float.patch
$REPO/node_modules/grunt-browser-sync/node_modules/browser-sync/node_modules/connect/‌​node_modu les/multiparty/node_modules/readable-stream/node_modules/core-util-is/float.patc‌​h 
/usr/lib/node_modules/bower/node_modules/depress-zip/node_modules/readable-s‌​tream/nod e_modules/core-util-is/float.patch

But it's not js file.

I have application, that I'm starting to work with, I'm just want to run it, but it crash. It use grunt, that run node server, it's Angular.js application. When I'm running grunt task that run the server and when I try to access the app from the browser, I've got warnings from grunt or node:

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

lot of lines and finaly:

util.js:35
  var str = String(f).replace(formatRegExp, function(x) {
                      ^
RangeError: Maximum call stack size exceeded Use --force to continue.

    Aborted due to warnings.

I've try to search in my application for for process.nextTick but it's in lot of places in node_modules directory, and not in src.

Is it possilbe to remove that warning so I can run the application? What code should I search for this recursive call?

UPDATE

I use ack and found that this line came from this file in 3 places:

$REPO/node_modules/express/node_modules/connect/node_modules/multiparty/node_modules/‌​readable- stream/node_modules/core-util-is/float.patch
$REPO/node_modules/grunt-browser-sync/node_modules/browser-sync/node_modules/connect/‌​node_modu les/multiparty/node_modules/readable-stream/node_modules/core-util-is/float.patc‌​h 
/usr/lib/node_modules/bower/node_modules/depress-zip/node_modules/readable-s‌​tream/nod e_modules/core-util-is/float.patch

But it's not js file.

Share Improve this question edited Mar 25, 2014 at 19:55 jcubic asked Mar 25, 2014 at 19:42 jcubicjcubic 66.7k58 gold badges249 silver badges453 bronze badges 4
  • Post the inline function you give to replace() – salezica Commented Mar 25, 2014 at 19:44
  • Related: stackoverflow./q/20792341/1903116 – thefourtheye Commented Mar 25, 2014 at 19:54
  • Also: groups.google./forum/#!topic/nodejs/9_uM04IDNWg – thefourtheye Commented Mar 25, 2014 at 19:55
  • Presumably the person who wrote it wasn't getting all of these errors. Perhaps you should be running it on node v0.8.0? – loganfsmyth Commented Mar 26, 2014 at 3:13
Add a ment  | 

4 Answers 4

Reset to default 7

This might be a grunt issue. Grunt will vomit if there's repetition in your naming conventions.

This will break:

grunt.registerTask('foo', [ 'foo']);

This will not:

grunt.registerTask('foo', [ 'bar']);

Check out this SO post: grunt throw "Recursive process.nextTick detected"

npm dedupe solved it for me. Basically it reduces package duplication:

Searches the local package tree and attempts to simplify the overall structure by moving dependencies further up the tree, where they can be more effectively shared by multiple dependent packages.

More information

In my case I got the following warning before this error thrown:

Running "watch" task
Waiting...
Warning: watch ENOSPC

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

This error indicates that number of resources it tries to watch is higher that the limit for this user. That's why running as root user (which doesn't have these limits) works fine. But this is not a solution.

Find out what is limit for your user in Linux:

sysctl --all | grep watches

Try to increase number of watches for your current user:

echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

This should do the trick.

As posted by me here: grunt throw "Recursive process.nextTick detected"

Alternative solution: check your watch for an empty file argument.

Here's an excerpt of my gruntfile

watch: {
  all: {
    options:{
      livereload: true
    },
    files: ['src/scss/*.scss', 'src/foo.html',, 'src/bar.html'],
    tasks: ['default']
  }
}

In my case, I could recreate the original poster's error on demand with the empty argument above.

发布评论

评论列表(0)

  1. 暂无评论