nrepl / weasel

ClojureScript browser REPL using WebSockets
The Unlicense
324 stars 35 forks source link

Compatible with latest CLJS/REPL stuff? #58

Closed brandonparsons closed 9 years ago

brandonparsons commented 9 years ago

Sorry for the poorly titled issue.... I'm struggling my way into the CLJS ecosystem :)

Getting the following error after trying to launch a CLJS REPL with Weasel/Piggieback:

java.lang.IllegalArgumentException: No implementation of method: :-setup of protocol: #'cljs.repl/IJavaScriptEnv found for class: clojure.lang.PersistentArrayMap
    at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:555)
    at cljs.repl$eval21169$fn__21185$G__21160__21192.invoke(repl.clj:106)
    at cemerick.piggieback.DelegatingREPLEnv._setup(piggieback.clj:88)
    at cljs.repl$repl_STAR_$fn__21568.invoke(repl.clj:754)
    at cljs.compiler$with_core_cljs.invoke(compiler.clj:951)
    at cljs.repl$repl_STAR_.invoke(repl.clj:751)
    at cemerick.piggieback$run_cljs_repl.invoke(piggieback.clj:123)
    at cemerick.piggieback$cljs_repl.doInvoke(piggieback.clj:162)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at user$browser_repl.invoke(user.clj:36)
    at user$eval22608.invoke(form-init2121599603050665414.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6767)
    at clojure.lang.Compiler.eval(Compiler.java:6730)
    at clojure.core$eval.invoke(core.clj:3076)
    at clojure.main$repl$read_eval_print__7311$fn__7314.invoke(main.clj:239)
    at clojure.main$repl$read_eval_print__7311.invoke(main.clj:239)
    at clojure.main$repl$fn__7320.invoke(main.clj:257)
    at clojure.main$repl.doInvoke(main.clj:257)
    at clojure.lang.RestFn.invoke(RestFn.java:1523)
    at clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__4089.invoke(interruptible_eval.clj:72)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1864)
    at clojure.lang.RestFn.invoke(RestFn.java:425)
    at clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:56)
    at clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__4131$fn__4134.invoke(interruptible_eval.clj:191)
    at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__4126.invoke(interruptible_eval.clj:159)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

Calling function was:

(defn browser-repl []
  (let [weasel-repl-env (weasel.repl.websocket/repl-env :ip "0.0.0.0" :port 9001)]
    (cemerick.piggieback/cljs-repl {:repl-env weasel-repl-env})))
cichli commented 9 years ago

I think that should be (cemerick.piggieback/cljs-repl :repl-env weasel-repl-env) (i.e. keyword arg rather than options map), unless you're using piggieback 0.2.0-SNAPSHOT, in which case: (cemerick.piggieback/cljs-repl weasel-repl-env).

brandonparsons commented 9 years ago

@cichli I am trying to use 0.2.0-SNAPSHOT, and changed it to (cemerick.piggieback/cljs-repl weasel-repl-env).

My particular error went away, but now I'm getting a new one....

java.io.IOException: No client connected to Websocket
    at weasel.repl.server$send_BANG_.invoke(server.clj:25)
    at weasel.repl.websocket$send_for_eval_BANG_.invoke(websocket.clj:93)
    at weasel.repl.websocket$websocket_eval.invoke(websocket.clj:82)
    at weasel.repl.websocket.WebsocketEnv._evaluate(websocket.clj:28)
    at cemerick.piggieback.DelegatingREPLEnv._evaluate(piggieback.clj:90)
    at cljs.repl$load_namespace.invoke(repl.clj:192)
    at cljs.repl$load_dependencies.invoke(repl.clj:201)
    at cljs.repl$evaluate_form.invoke(repl.clj:444)
    at cljs.repl$eval_cljs.invoke(repl.clj:527)
    at cljs.repl$repl_STAR_$read_eval_print__21573.invoke(repl.clj:783)
    at cljs.repl$repl_STAR_$fn__21579$fn__21586.invoke(repl.clj:821)
    at cljs.repl$repl_STAR_$fn__21579.invoke(repl.clj:820)
    at cljs.compiler$with_core_cljs.invoke(compiler.clj:951)
    at cljs.repl$repl_STAR_.invoke(repl.clj:785)
    at cemerick.piggieback$run_cljs_repl.invoke(piggieback.clj:123)
    at cemerick.piggieback$cljs_repl.doInvoke(piggieback.clj:162)
    at clojure.lang.RestFn.invoke(RestFn.java:410)
    at user$browser_repl.invoke(user.clj:37)
    at user$eval22622.invoke(form-init92733787290748673.clj:1)
    at clojure.lang.Compiler.eval(Compiler.java:6767)
    at clojure.lang.Compiler.eval(Compiler.java:6730)
    at clojure.core$eval.invoke(core.clj:3076)
    at clojure.main$repl$read_eval_print__7311$fn__7314.invoke(main.clj:239)
    at clojure.main$repl$read_eval_print__7311.invoke(main.clj:239)
    at clojure.main$repl$fn__7320.invoke(main.clj:257)
    at clojure.main$repl.doInvoke(main.clj:257)
    at clojure.lang.RestFn.invoke(RestFn.java:1523)
    at clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__4089.invoke(interruptible_eval.clj:72)
    at clojure.lang.AFn.applyToHelper(AFn.java:152)
    at clojure.lang.AFn.applyTo(AFn.java:144)
    at clojure.core$apply.invoke(core.clj:626)
    at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1864)
    at clojure.lang.RestFn.invoke(RestFn.java:425)
    at clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke(interruptible_eval.clj:56)
    at clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__4131$fn__4134.invoke(interruptible_eval.clj:191)
    at clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__4126.invoke(interruptible_eval.clj:159)
    at clojure.lang.AFn.run(AFn.java:22)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
    at java.lang.Thread.run(Thread.java:745)

My client-side code that goes along with this:

(ws-repl/connect "ws://127.0.0.1:9001"
                 :verbose true
                 :print #{:repl :console}
                 :on-error #(print "Error! " %))

I have tried using 127.0.0.1 and localhost and get various errors. I'm wondering if I'm doing something totally wrong.

brandonparsons commented 9 years ago

On the client side I"m seeing:

WebSocket connection to 'ws://localhost:9001/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
repl.cljs:80 WebSocket error goog.net.WebSocket.ErrorEvent {type: "error_1", target: goog.net.WebSocket, currentTarget: goog.net.WebSocket, propagationStopped_: false, defaultPrevented: false…}
core.cljs:116 Error!  #<[object Object]>
repl.cljs:75 Closed Websocket REPL connection
tomjakubowski commented 9 years ago

Sounds like something in piggieback is trying to eval during the -setup phase. Weasel really needs to block until a client connects for it to work properly. There's an open issue at #51 that now must be fixed.

— Sent from Mailbox

On Wed, Mar 25, 2015 at 7:02 PM, brandonparsons notifications@github.com wrote:

On the client side I"m seeing:

WebSocket connection to 'ws://localhost:9001/' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED
repl.cljs:80 WebSocket error goog.net.WebSocket.ErrorEvent {type: "error_1", target: goog.net.WebSocket, currentTarget: goog.net.WebSocket, propagationStopped_: false, defaultPrevented: false…}
core.cljs:116 Error!  #<[object Object]>
repl.cljs:75 Closed Websocket REPL connection

Reply to this email directly or view it on GitHub: https://github.com/tomjakubowski/weasel/issues/58#issuecomment-86292626

brandonparsons commented 9 years ago

Gotcha. Will keep an eye on both!

tomjakubowski commented 9 years ago

@brandonparsons if you weren't scared off by how everything in REPL land is always breaking (sorry!), did you manage to try out one of the newer Weasel snapshots?

brandonparsons commented 9 years ago

@tomjakubowski I did get a tad scared away (don't worry - I understand everything is in flux right now!), and this was just a bit of a side project.

Whenever I do pick up CLJS again, I will be giving this another shot :)

I will close this issue for now!