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:

  • Docker PHP / Apache Container - Sendmail 553 Error “Domain of Sender Address does not exist” when trying to send mail
  • Exposing a TTY device in a docker container with docker for mac
  • php-fpm process hight memory usage, and the host jammed
  • Is there a way to alter path where docker looks for repository certificates?
  • Docker Redis container getting WARNING: /proc/sys/net/core/somaxconn in a user defined network
  • Docker daemon fails to start: inotify_add_watch: no such file or directory
  •  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!

  • ubuntu 14.04 SuperDesk Raven not configured (logging is disabled)
  • Deploy a docker image from a registry with basic auth
  • AWS Elastic Beanstalk Docker deployment failed
  • Is there a way to force docker-machine to create vm with a specific ip?
  • SSH forwarding with Spring Cloud Config inside Docker
  • MySQL scripts in docker-entrypoint-initdb are not executed
  • One Solution collect form web for “grunt serve in docker container max call stack error”

    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.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.