2

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.

jcubic
  • 61,973
  • 54
  • 229
  • 402

4 Answers4

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"

Community
  • 1
  • 1
MT3
  • 1,065
  • 3
  • 13
  • 22
  • Found the reson for this, it was because of resourses limitation (I think because of stack size). My account have limits, I didn't know even that there is something like limits on linux. When I run the app from root it work fine. – jcubic Jun 05 '14 at 19:15
  • @AlexanderBurakevych I've run the app with `sudo` on linux and it work without errors. – jcubic Apr 22 '15 at 11:42
  • @jcubic The core issue (at least in my case) was the limited number of user_watches: fs.inotify.max_user_watches. Once set to higher number - it worked fine. I guess sudo user doesn't have this limit. http://stackoverflow.com/questions/16748737/grunt-watch-error-waiting-fatal-error-watch-enospc – Alexander Burakevych Apr 22 '15 at 23:42
3

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

1

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.

Alexander Burakevych
  • 2,396
  • 1
  • 24
  • 25
0

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.

Community
  • 1
  • 1
Brian Muenzenmeyer
  • 1,026
  • 1
  • 7
  • 17