Grunt was working. But after moving my site's files up one directory, to sit at root, grunt stopped working:
Fatal error: Port 35729 is already in use by another process.
Would the path matter in this case? Looking at port 35729, I found that Grunt was the only process running on that port. I killed that process, confirmed that no other process was running on 35729, then ran grunt again, but still getting that same fatal error as before.
Although none of my config files changed for grunt since it was working, I thought I'd try using the "npm init" approach to create a new package.json, then run "npm install" again and confirmed it downloaded "node_modules". What else can I try?
I'm running Node v0.10.33 on Mac OS 10.10.5
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
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With