Why does swank-js give me "document is not defined" in the emacs REPL?
Asked Answered
K

1

7

I follow these steps:

  1. Run swank-js in the command line.
  2. Run emacs.
  3. M-x slime-connect.
  4. Host: 127.0.0.1; Port: 4005
  5. Open up the http://localhost:8009/swank-js/test.html in Firefox.
  6. Receive: "Remote attached: (browser) Firefox14.0" in the emacs REPL.
  7. Run the command "document" in the REPL.

At this point, I receive the error:

ReferenceError: document is not defined
    at repl:1:1
    at DefaultRemote.evaluate (/usr/lib/nodejs/swank-js/swank-handler.js:314:9)
    at Executive.listenerEval (/usr/lib/nodejs/swank-js/swank-handler.js:414:21)
    at Handler.receive (/usr/lib/nodejs/swank-js/swank-handler.js:169:20)
    at SwankParser.onMessage (/usr/lib/nodejs/swank-js/swank.js:50:17)
    at SwankParser.handleMessage (/usr/lib/nodejs/swank-js/swank-protocol.js:75:8)
    at SwankParser.handleContent (/usr/lib/nodejs/swank-js/swank-protocol.js:62:10)
    at SwankParser.execute (/usr/lib/nodejs/swank-js/swank-protocol.js:53:20)
    at Socket.<anonymous> (/usr/lib/nodejs/swank-js/swank.js:60:16)
    at Socket.emit (events.js:67:17)

Should I be using require() or something? I'm still a bit hazy how swank/slime/node are communicating so please forgive the black box nature of this question. :D

Kira answered 22/8, 2012 at 4:9 Comment(2)
By the way, if you haven't already seen this. I thought you might appreciate it: emacsrocks.com/e11.htmlObrien
Thanks! That's actually the reason I started to try JavaScript and swank-js. I believe the problem had to do with me creating a symlink within the slime directory (to swank-js), and then, for some reason, changing out my slime-js file? But, the short of it is to ensure your slime-js file is correct. :DKira
U
4

Judging by the bug report at https://github.com/swank-js/swank-js/issues/49#issuecomment-8079040, I'd guess you aren't loading the slime-js component.

Uracil answered 28/8, 2012 at 4:52 Comment(1)
This was correct - I had an error loading slime-js. (I will award the bounty when the time limit expires.) Thanks for your help!Kira

© 2022 - 2024 — McMap. All rights reserved.