Grunt message: Fatal error: Port 35729 is already in use by another process

The problem is grunt-contrib-watch's live reload: https://github.com/gruntjs/grunt-contrib-watch/blob/v1.0.0/tasks/lib/livereload.js#L19

You can't have two grunt-watch with the livereload option set to true. Either set one of the livereload options to false or change the port of liverelaod to something else by setting the livereload option from true to other value than 35729, like live-reload: 1337.

See the docs for more: https://github.com/gruntjs/grunt-contrib-watch#optionslivereload

Otherwise, you can run as many grunt processes as you want.


Grunt watch was already running in a different project in my case. So I updated Grunt's watch task appropriately for live reload to watch on a different port.

 watch: {
        main: {
            options: {
                livereload: 35730,
                livereloadOnError: false,
                spawn: false
            },
            files: [createFolderGlobs(['*.js', '*.less', '*.html']), '!_SpecRunner.html', '!.grunt'],
            tasks: [] //all the tasks are run dynamically during the watch event handler
        }
    }

Specified livereload:PORT


Dont stop a process with Ctrl+C in the terminal.

Ctrl+Z will keep it running.

Find the process id by sudo lsof -i :35729

Then kill the process by sudo kill -9 PID

Rerun the grunt watch