I'm setting grunt-contrib-watch
, and grunt-contrib-connect
to live reload, like this:
watch: {
options: {
livereload: true,
},
files: ['src/**/*'],
tasks: ['serve']
},
connect: {
server: {
options: {
port: 8000,
base: './dist',
hostname: '0.0.0.0',
protocol: 'http',
livereload: true,
open: true,
}
}
},
But I'm getting this error when connect tries to reload:
Running "connect:server" (connect) task Fatal error: Port 8000 is already in use by another process.
I tried a few different ports, but had the same problem.
I don't get how grunt-contrib-connect
server can have a conflict with it's own port.
How can I get this to work?
It turns out, the
serve
task was where I was starting the server, so it was trying to start another server every time it reloaded. I switched it to adev
task where the site was recompiled, but doesn't start a server.