fregante / GhostText

👻 Use your text editor to write in your browser. Everything you type in the editor will be instantly updated in the browser (and vice versa).
https://GhostText.fregante.com
MIT License
3.29k stars 117 forks source link

Doesn't open Sublime Text #63

Closed revolter closed 6 years ago

revolter commented 8 years ago

For some reason, it doesn't work on the mac at work. I click the Chrome Add-on button, it asks me to select the desired text area, and after clicking it, the "There are multiple ..." popup remains open and it does nothing. No error in the Chrome or Sublime Text console.

fregante commented 8 years ago

What site is that happening on? Does it work on this page?

revolter commented 8 years ago

Any site. No, it doesn't work here. I'm also on OS X 10.10.5.

I'm getting these in the console:

GhostText: There are multiple text areas on this page. 
  Click on the one you want to use.
GhostText: detector.focusEvent()
GhostText: reportFieldData()
GhostText: detector.focusEvent()
GhostText: reportFieldData()
GhostText: detector.focusEvent()
GhostText: reportFieldData()
GhostText: detector.focusEvent()
GhostText: reportFieldData()

And if I open Sublime Text and open the browser again, a red popup appears with the message:

Connection error. 
Make sure that Sublime Text is open and has GhostText installed. 
Try closing and opening it and try again. 
Make sure that the port matches (4001 is the default). 
See if there are any errors in Sublime Text's console.
fregante commented 8 years ago

Thanks! Let's try this:

  1. Reinstall GT in Sublime Text
  2. Restart Sublime Text
  3. Reopen this tab (to avoid any GT remnants)
  4. Click the GT button in Chrome
  5. Click on the Reply box
  6. Copy what's in the Sublime Text console (possibly all of it, to see if GT server has started correctly)
revolter commented 8 years ago

Still nothing shows up in the Sublime Text console after selecting this text area, but I found some interesting logs written on Sublime Text start:

plugins loaded
PyV8: Creating new thread
Emmet: Creating thread
Emmet: Loading https://api.github.com/repos/emmetio/pyv8-binaries/contents
Emmet: You have the most recent PyV8 binary
Package Control: Repository http://sublime.wbond.net/repositories.json does not appear to be a valid repository file because  the "packages" key is an object, not an array. This indicates it is a channel not a repository.
Package Control: Repository http://sublime.wbond.net/repositories.json does not appear to be a valid repository file because  the "packages" key is an object, not an array. This indicates it is a channel not a repository.
Package Control: No updated packages
ignored packages updated to: ["GhostText", "Vintage"]
reloading Packages/User/Package Control.sublime-settings
reloading Packages/User/Preferences.sublime-settings
reloading Packages/User/Package Control.sublime-settings
ignored packages updated to: ["Vintage"]
reloading plugin GhostText.FocusSublimeWindow
reloading plugin GhostText.GhostText
GhostText is starting now…
Traceback (most recent call last):
  File "/Applications/Sublime Text.app/Contents/MacOS/sublime_plugin.py", line 120, in reload_plugin
    m.plugin_loaded()
  File "GhostText in /Users/Iulian/Library/Application Support/Sublime Text 3/Installed Packages/GhostText.sublime-package", line 159, in plugin_loaded
  File "GhostText in /Users/Iulian/Library/Application Support/Sublime Text 3/Installed Packages/GhostText.sublime-package", line 69, in __init__
  File "Http.HttpServer in /Users/Iulian/Library/Application Support/Sublime Text 3/Installed Packages/GhostText.sublime-package", line 14, in __init__
OSError: [Errno 49] Can't assign requested address
reloading Packages/GhostText/GhostText.sublime-settings
reloading Packages/User/Package Control.sublime-settings
reloading Packages/User/Preferences.sublime-settings
reloading Packages/User/Preferences.sublime-settings
fregante commented 8 years ago

I think Can't assign requested address refers to either a port already in use or a misassignment of localhost

Try running this command when Sublime Text is closed:

lsof -i :4001

It shouldn't output anything. If it does stop here and post a screenshot/copy-paste.

Now open ST and run lsof again, GhostText should be using that port as soon as you open Sublime Text and it should look something like this:

Port 4001 used by GhostText-ST

Do you have any server running locally? Does localhost work correctly there?

revolter commented 8 years ago

Uhm, I modified the hosts file and localhost points to another PC on the network. So this must be the cause. That command doesn't output anything indifferently if Sublime Text is opened or not.

I removed that and the command generated output like yours. But it still doesn't connect. I'll restart Chrome and update this comment.

Edit: It gives me the red popup error immediately after selecting the text area. Is a system restart necessary?

fregante commented 8 years ago

Repeat this and let's see what we have now: https://github.com/Cacodaimon/GhostText-for-SublimeText/issues/63#issuecomment-202321121

@Cacodaimon I'm thinking we should replace localhost with 127.0.0.1. If you don't see any possible issues with that I can make that change everywhere.

revolter commented 8 years ago
Package Control: Repository http://sublime.wbond.net/repositories.json does not appear to be a valid repository file because  the "packages" key is an object, not an array. This indicates it is a channel not a repository.
Package Control: No updated packages
ignored packages updated to: ["GhostText", "Vintage"]
reloading Packages/User/Package Control.sublime-settings
reloading Packages/User/Preferences.sublime-settings
reloading Packages/User/Package Control.sublime-settings
ignored packages updated to: ["Vintage"]
reloading plugin GhostText.FocusSublimeWindow
reloading plugin GhostText.GhostText
GhostText is starting now…
Setting on request handler
reloading Packages/GhostText/GhostText.sublime-settings
HTTP Start
reloading Packages/User/Package Control.sublime-settings
reloading Packages/User/Preferences.sublime-settings
reloading Packages/User/Preferences.sublime-settings

~ ❯ lsof -i :4001
COMMAND     PID   USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
plugin_ho 51443 Iulian   37u  IPv4 0xda3bc363e8692939      0t0  TCP localhost:newoak (LISTEN)
fregante commented 8 years ago

Thank you! The server seems to be starting but I'm not sure of where the issue is now. Any new messages in Chrome's console?

revolter commented 8 years ago

I attached the Chrome log: github.com-1459173729368.log.zip

revolter commented 6 years ago

It works now, thanks for reminding me about this.

fregante commented 6 years ago

That's good to hear! I definitely didn't know what was up back then 😅

revolter commented 6 years ago

Probably my computer's fault. I changed it since then too.

NBR-hugh commented 6 years ago
GhostText: selectField()
input-area.js:298 TypeError: Cannot read property 'querySelectorAll' of null
    at Detector.addAceElements (input-area.js:252)
    at Detector.detect (input-area.js:195)
    at Detector.addIframes (input-area.js:295)
    at Detector.detect (input-area.js:199)
    at Object.selectField (content.js:160)
    at messageHandler (content.js:49)
    at EventImpl.dispatchToListener (VM23 extensions::event_bindings:403)
    at Event.publicClassPrototype.(anonymous function) [as dispatchToListener] (extensions::utils:138:26)
    at EventImpl.dispatch_ (VM23 extensions::event_bindings:387)
    at EventImpl.dispatch (VM23 extensions::event_bindings:409)