Chrome service-worker process running on port 3000

2019-03-31 10:58发布

问题:

The following error shows up in my Rails app logs and in my Chrome JavaScript console, but only on Chrome, and only when the app is running on localhost on port 3000:

Started GET "/service-worker.js" for 127.0.0.1 at 2015-12-15 09:31:04 -0800
ActionController::RoutingError (No route matches [GET] "/service-worker.js"):

Apparently someone else has had this same problem, but solved it by reinstalling the OS (!). This isn't an option for me.

According to lsof, there is some other some other process running on port 3000:

COMMAND     PID   FD   TYPE   NODE NAME
Google    49368  174u  IPv4   TCP localhost:55612->localhost:hbci (CLOSE_WAIT)
ruby      57985  17u   IPv4   TCP *:hbci (LISTEN)

Other things of note:

  • NodeJS is installed
  • Chrome Version 47.0.2526.80 (64-bit) on OS X 10.10.5
  • The stuff in chrome://flags/ has been reset to default
  • I've disabled all Chrome extensions
  • If I kill that Google process, it just reappears

What is this uninvited process?

回答1:

Visit chrome://serviceworker-internals/ to view a list of service workers.

Click the "Unregister" button to remove the registration of the offender.

The Google Web Starter Kit installs a service worker that may continue running after using its local development server.

ALL CREDIT for this answer goes to Jeff Posnick. Just thought this question should have a formal answer that's easy to find since it was driving me to madness before I came across this page :)