Fork me on GitHub
#cider
<
2020-06-23
>
sofra01:06:35

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}
java.lang.NullPointerException
	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 clojure.lang.AFn.call(AFn.java:18)
	at java.util.concurrent.FutureTask.run(FutureTask.java:266)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
	at java.lang.Thread.run(Thread.java:748)

dpsutton02:06:44

How are you starting the nrepl server?

Casey07:06:04

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

Casey07:06:21

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

bozhidar08:06:56

I know some people just add a simple command that wraps the test runner. There’s also https://github.com/magnars/kaocha-runner.el which probably works in such cases.

naomarik13:06:11

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

Casey13:06:26

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

Casey13:06:45

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

naomarik14:06:59

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.

dpsutton20:06:05

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"}}}

dpsutton20:06:52

that's a weird one

dpsutton20:06:10

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

naomarik20:06:16

not really -- just add refactor-nrepl

dpsutton20:06:27

i'm confused why it would expect it there

naomarik20:06:27

: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"
                       "[cider.nrepl/cider-middleware,refactor-nrepl.middleware/wrap-refactor]"]}
this is what I have in mine

🎉 3
naomarik20:06:19

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

Drew Verlee20:06:35

correct, im not running from emacs

naomarik20:06:03

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

naomarik20:06:16

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

naomarik20:06:23

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

naomarik20:06:51

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

naomarik20:06:01

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

naomarik20:06:25

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?

naomarik20:06:05

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

naomarik20:06:13

-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?

naomarik22:06:40

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

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>

naomarik20:06:24

you might have some other file somewhere else

naomarik20:06:38

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

naomarik20:06:53

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

naomarik21:06:59

what's clj -Sdescribe say?