grunt serve in docker container max call stack error

Running grunt serve in a docker container causes node to crash (for lack of a better term).

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

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

When I run the app * locally * it works as expected. This * only * happens when running it in the container. My guess is that it's the live reload or one of the other port mappings causing the issue but I don't know how to debug it. I expose the ports used by node in the dockerfile:

 EXPOSE 9000 9001 35729

...grunt task...

 grunt.registerTask('serve', 'Compile then start a connect web server', function (target) {
if (target === 'dist') {
  return grunt.task.run(['build', 'connect:dist:keepalive']);
}

grunt.task.run([
  'clean:server',
  'wiredep',
  'concurrent:server',
  'autoprefixer',
  'connect:livereload',
  'watch'
]);
 });


clean: {
  dist: {
    files: [{
      dot: true,
      src: [
        '.tmp',
        '<%= yeoman.dist %>/{,*/}*',
        '!<%= yeoman.dist %>/.git*'
      ]
    }]
  },
  server: '.tmp'
},
wiredep: {
  options: {
    cwd: '<%= yeoman.app %>'
  },
  app: {
    src: ['<%= yeoman.app %>/index.html'],
    ignorePath:  /\.\.\//
  }
},
concurrent: {
  server: [
    'copy:styles'
  ],
  test: [
    'copy:styles'
  ],
  dist: [
    'copy:styles',
    'imagemin',
    'svgmin'
  ]
},
autoprefixer: {
  options: {
    browsers: ['last 1 version']
  },
  dist: {
    files: [{
      expand: true,
      cwd: '.tmp/styles/',
      src: '{,*/}*.css',
      dest: '.tmp/styles/'
    }]
  }
},
watch: {
  bower: {
    files: ['bower.json'],
    tasks: ['wiredep']
  },
  js: {
    files: ['<%= yeoman.app %>/scripts/{,*/}*.js'],
    tasks: ['newer:jshint:all'],
    options: {
      livereload: '<%= connect.options.livereload %>'
    }
  },
  jsTest: {
    files: ['test/spec/{,*/}*.js'],
    tasks: ['newer:jshint:test', 'karma']
  },
  styles: {
    files: ['<%= yeoman.app %>/styles/{,*/}*.css'],
    tasks: ['newer:copy:styles', 'autoprefixer']
  },
  gruntfile: {
    files: ['Gruntfile.js']
  },
  livereload: {
    options: {
      livereload: '<%= connect.options.livereload %>'
    },
    files: [
      '<%= yeoman.app %>/{,*/}*.html',
      '.tmp/styles/{,*/}*.css',
      '<%= yeoman.app %>/images/{,*/}*.{png,jpg,jpeg,gif,webp,svg}'
    ]
  }
},
....

I've found related issues on stackoverflow but the solutions don't seem to solve my issue.

Thanks!

I encountered this error when my Gruntfile.js has the following code:

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

I solve the problem by renaming the code to:

grunt.registerTask('s', ['svgmin']);

The problem of the code is that it created a new task called 'svgmin' to run 'svgmin' task which cause the infinite looping.

Hope it helps.