Port error: Could not establish connection. Receiving end does not exist. In Chromiume
This isn't always the cause, but if you have an error in your background.js
, you should check this link:
Inspect views: _generated_background_page.html
in the Extensions page, which will show you any JavaScript errors.
This was preventing my connections from getting established.
The problem could be that and sendRequest()
have been deprecated and replaced with onRequest
sendMessage()
and onMessage
. Since a recent Chrome 20 update they seem to be gone completely.
The official documentation on Message Passing doesn't even mention anymore.sendRequest()
Here is a link which documents the change a little bit: http://codereview.chromium.org/9965005/
I found myself having the same issue as you describe here. The solution I found that works for me is to use a backgroundpage instead of a background script, like so:
"background_page": "src/background.html",
// maybe this seems to work instead of background { scripts [] }
/* this gives a Port error: Could not ...
"background": {
"scripts": ["src/background.js"]
},
*/
I hope this works for you too.