warning: Recursive process.nextTick detected

喜欢而已 提交于 2019-12-11 02:48:10

问题


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/decompress-zip/node_modules/readable-s‌​tream/nod e_modules/core-util-is/float.patch

But it's not js file.


回答1:


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"




回答2:


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




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/22644709/warning-recursive-process-nexttick-detected

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!