Search code examples
node.jsgrunt-contrib-watch

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


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


Solution

  • Problem solved. Although grunt-cli is installed globally, grunt gets installed locally with the project. So when I moved my site's files up one directory, and ran grunt from that new location, I was effectively launching a second instance of grunt, which found the port already occupied of course, by the earlier instance of grunt launched before moving files.

    After I killed that process, grunt ran without a problem. I wasn't able to kill it using kill -9 so I used the Mac's Activity Monitor to issue "Force Quit".