Fork me on GitHub
#nrepl
<
2019-06-24
>
pez19:06:00

I have a strange bug in Calva’s cljs repl handling that I can’t wrap my head around. I think I have reasons to suspect something in the Orchard territory, but really, it could be just me doing something wrong in my usage as well. So here is what happens: I can create a CLJS repl by evaluating

(do (require '[cljs.repl.node]) (require '[cider.piggieback]) (cider.piggieback/cljs-repl (cljs.repl.node/repl-env)))
and that repl works. But if I clone it (the nrepl op clone, that is), then evaluating something as simple as 42 I get this stack trace:
java.lang.NullPointerException
	at cljs.repl.node$node_eval.invokeStatic(node.clj:66)
	at cljs.repl.node$node_eval.invoke(node.clj:60)
	at cljs.repl.node.NodeEnv._evaluate(node.clj:238)
	at user.Delegatingcljs_repl_node_NodeEnv._evaluate(form-init5732710029644372935.clj:66)
	at cljs.repl$evaluate_form.invokeStatic(repl.cljc:569)
	at cljs.repl$evaluate_form.invoke(repl.cljc:499)
	at cider.piggieback$eval_cljs.invokeStatic(piggieback.clj:208)
	at cider.piggieback$eval_cljs.invoke(piggieback.clj:207)
	at cider.piggieback$do_eval$fn__1599.invoke(piggieback.clj:244)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invokeStatic(core.clj:665)
	at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1973)
	at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1973)
	at clojure.lang.RestFn.invoke(RestFn.java:425)
	at cider.piggieback$do_eval.invokeStatic(piggieback.clj:221)
	at cider.piggieback$do_eval.invoke(piggieback.clj:220)
	at cider.piggieback$evaluate.invokeStatic(piggieback.clj:267)
	at cider.piggieback$evaluate.invoke(piggieback.clj:265)
	at clojure.lang.Var.invoke(Var.java:384)
	at cider.piggieback$wrap_cljs_repl$fn__1615$fn__1618$fn__1619.invoke(piggieback.clj:299)
	at cider.piggieback$enqueue$fn__1585.invoke(piggieback.clj:191)
	at clojure.lang.AFn.run(AFn.java:22)
	at nrepl.middleware.session$session_exec$main_loop__1022$fn__1026.invoke(session.clj:171)
	at nrepl.middleware.session$session_exec$main_loop__1022.invoke(session.clj:170)
	at clojure.lang.AFn.run(AFn.java:22)
	at java.lang.Thread.run(Thread.java:748)
class java.lang.NullPointerException

pez19:06:22

That repl server is started like so:

lein update-in :dependencies conj "[nrepl \"0.6.0\"]" -- update-in :dependencies conj "[cider/piggieback \"0.4.1\"]" -- update-in :dependencies conj "[figwheel-sidecar \"0.5.18\"]" -- update-in :plugins conj "[cider/cider-nrepl \"0.21.1\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.nrepl/cider-middleware\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.piggieback/wrap-cljs-repl\"]" -- with-profile +dev repl :headless