Fork me on GitHub

I am trying to follow the instruction here to get and embedded nrepl server. It works without the cider-nrepl-handler but when I add it I start getting null pointer exceptions. Not really sure how to start debugging this. using

[nrepl "0.7.0"]
[cider/cider-nrepl "0.25.2"]
with exceptions
ERROR: Unhandled REPL handler exception processing message {:op out-subscribe, :session ae41ee90-9689-44cf-b204-c1381837eeb0, :id 5}
ERROR: Unhandled REPL handler exception processing message {:op classpath, :session ae41ee90-9689-44cf-b204-c1381837eeb0, :id 6}
	at clojure.core$deref_future.invokeStatic(core.clj:2300)
	at clojure.core$deref.invokeStatic(core.clj:2320)
	at clojure.core$deref.invoke(core.clj:2306)
	at cider.nrepl$wrap_out$fn__8686.invoke(nrepl.clj:312)
	at nrepl.middleware$wrap_conj_descriptor$fn__7978.invoke(middleware.clj:16)
	at cider.nrepl$wrap_undef$fn__8740.invoke(nrepl.clj:471)
	at nrepl.middleware$wrap_conj_descriptor$fn__7978.invoke(middleware.clj:16)
	at cider.nrepl$wrap_apropos$fn__8622.invoke(nrepl.clj:118)
	at nrepl.middleware$wrap_conj_descriptor$fn__7978.invoke(middleware.clj:16)
	at cider.nrepl$wrap_test$fn__8722.invoke(nrepl.clj:420)
	at nrepl.middleware$wrap_conj_descriptor$fn__7978.invoke(middleware.clj:16)
	at nrepl.middleware.print$wrap_print$fn__8181.invoke(print.clj:234)
	at nrepl.middleware$wrap_conj_descriptor$fn__7978.invoke(middleware.clj:16)
	at cider.nrepl$wrap_trace$fn__8728.invoke(nrepl.clj:442)
	at nrepl.middleware$wrap_conj_descriptor$fn__7978.invoke(middleware.clj:16)
	at cider.nrepl$wrap_tracker$fn__8734.invoke(nrepl.clj:460)
	at nrepl.middleware$wrap_conj_descriptor$fn__7978.invoke(middleware.clj:16)
	at cider.nrepl$wrap_complete$fn__8634.invoke(nrepl.clj:132)
	at nrepl.middleware$wrap_conj_descriptor$fn__7978.invoke(middleware.clj:16)
	at nrepl.middleware.sideloader$wrap_sideloader$fn__8431.invoke(sideloader.clj:102)
	at nrepl.middleware$wrap_conj_descriptor$fn__7978.invoke(middleware.clj:16)
	at nrepl.middleware.session$session$fn__8380.invoke(session.clj:297)
	at nrepl.middleware$wrap_conj_descriptor$fn__7978.invoke(middleware.clj:16)
	at nrepl.server$handle_STAR_.invokeStatic(server.clj:19)
	at nrepl.server$handle_STAR_.invoke(server.clj:16)
	at nrepl.server$handle$fn__8442.invoke(server.clj:36)
	at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(
	at java.util.concurrent.ThreadPoolExecutor$


How are you starting the nrepl server?


So, after adding cider/cider-nrepl to my ~/.shadow-cljs/config.edn things seem to be working well now.


Its noted that cider's test functions don't work for cljs, what's the conventional way to run cljs tests in the repl?


I know some people just add a simple command that wraps the test runner. There’s also which probably works in such cases.


Not in the REPL though, but I'm pretty happy with it.


Yea, that's what I'm using now. Its works well enough, but I miss being able to run single tests when working on one little issue like I can in normal clj+cider


I end up (comment)ing out deftests as needed but it is a little clunky


Yeah for me runs fast enough (actually instant for the tests I have) where I don't mind.

Drew Verlee20:06:41

i get the following error when i try to start an nrepl commandline:

➜  aft git:(master) ✗ clj -R:nrepl -m nrepl.cmdline                                                 
Execution error (FileNotFoundException) at nrepl.cmdline/require-and-resolve (cmdline.clj:194).
Could not locate refactor_nrepl/middleware__init.class, refactor_nrepl/middleware.clj or refactor_nrepl/middleware.cljc on classpath. Please check that namespaces with dashes use underscores in the Clojure file name.
I assume the solution here is to add refactor nrepl to my deps but the docs i was reading dont mention it.


what version of nrepl is present in the nrepl profile?

Drew Verlee20:06:29

{:nrepl {:extra-deps {nrepl/nrepl {:mvn/version "0.8.0-alpha4"} cider/piggieback {:mvn/version "0.5.0"}}}


that's a weird one


have you been hacking on nrepl and installed a custom version?


not really -- just add refactor-nrepl


i'm confused why it would expect it there


:repl {:extra-deps  {cider/cider-nrepl {:mvn/version "0.25.2"}
                       refactor-nrepl    {:mvn/version "2.5.0-SNAPSHOT"}
                       cider/piggieback  {:mvn/version "0.5.0"}}
         :extra-paths ["env/dev/resources" "env/dev/clj"]
         :main-opts   ["-m" "nrepl.cmdline" "--middleware"
this is what I have in mine

🎉 3

actually if you're not running from emacs it would be weird

Drew Verlee20:06:35

correct, im not running from emacs


maybe from piggieback dep? dunno...

Drew Verlee20:06:52

is my nrepl dep really old? i tried to get the latest but mine says 8 and yours 25

Drew Verlee20:06:41

oh thats cider nrepl on yours


i'm using {:mvn/version "0.6.0"} for nrepl

Drew Verlee20:06:29

if the goal is to launch a server that a nrepl port i can talk to so i can develop in a different context. then i wouldn't need cider which is for emacs


btw clj -Sdeps '{:deps {nrepl/nrepl {:mvn/version "0.8.0-alpha4"}}}' works for me without error


clj -Sdeps '{:deps { cider/piggieback {:mvn/version "0.5.0"}, nrepl/nrepl {:mvn/version "0.8.0-alpha4"}}}' works for me... maybe something else going?

Drew Verlee20:06:57

but those dont pass a main option

Drew Verlee20:06:40

-R:nrepl without piggy (and likely with) starts a repl. when i pass -m nrepl.cmdline it throws that error


ah forgot the main fn,

clj -Sdeps '{:deps { cider/piggieback {:mvn/version "0.5.0"}, nrepl/nrepl {:mvn/version "0.8.0-alpha4"}}}' -m "nrepl.cmdline"
nREPL server started on port 44073 on host localhost - 
this invokation works for me


maybe search your project for any hard references to refactor-nrepl or if deps.edn is merging config from somewhere else?

Drew Verlee20:06:46

ill do a clean

Drew Verlee20:06:32

That invocation fails for me in my project. would Sdeps override whats in my deps file? my ./clojure/deps.edn fils is empty. Is there any stale state that would be lying around?


does it work outside the project folder? i'm not sure to be honest about your question -- i would assume so

Drew Verlee20:06:44

it fails outside the project folder too.

Drew Verlee20:06:57

huh. thanks, ill look into this more


-Sdeps EDN Deps data to use as the last deps file to be merged

Drew Verlee20:06:08

what version of clojure are you running?


just saw this -- clj -Sdescribe says :version ""

Drew Verlee22:06:59

@U0DHHFEDP this command works for me: ➜ ~ clj -Sdeps '{:deps {cider/cider-nrepl {:mvn/version "0.25.2"} }}' -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" nREPL server started on port 46293 on host localhost - <nrepl://localhost:46293>


you might have some other file somewhere else


try it with this option -Srepro Ignore the ~/.clojure/deps.edn config file


clj -Sdeps -Srepro '{:deps { cider/piggieback {:mvn/version "0.5.0"}, nrepl/nrepl {:mvn/version "0.8.0-alpha4"}}}' -m "nrepl.cmdline"
nREPL server started on port 44073 on host localhost - 

Drew Verlee21:06:13

if i run

clj -Srepro -Sdeps '{:deps {cider/piggieback {:mvn/version "0.5.0"} nrepl/nrepl {:mvn/version "0.8.0-alpha4"}}}' -m "nrepl.cmdline"
(note you have to reverse the options from what you posted) i get the same missing refactor middleware error


what's clj -Sdescribe say?