I have a Luminus project with the server running on localhost:7000
. I use cider-connect
to attach myself to this repl, but I'm met with the following wall:
; CIDER 0.10.0snapshot (package: 20150820.852) \
(Java 1.7.0_51, Clojure 1.7.0, nREPL 0.2.10)
WARNING: The following required nREPL ops are not supported:
apropos classpath complete eldoc format-code format-edn info inspect-pop \
inspect-push inspect-refresh macroexpand ns-list ns-vars ns-path refresh \
resource stacktrace toggle-trace-var toggle-trace-ns undef
Please, install (or update) cider-nrepl 0.10.0-SNAPSHOT and restart CIDER
I would imagine at least one of these is required for debugging; attempts to instrument a function yield
clojure.lang.LispReader$ReaderException: java.lang.RuntimeException: \
No reader function for tag dbg
I can debug just fine with a 'normal' Clojure project. I've tried adding the boilerplate that normally goes in ~/.lein/profiles.clj
to the project's project.clj
to no effect:
:profiles/dev {:dependencies [[org.clojure/tools.nrepl "0.2.10"]]
:plugins [[cider/cider-nrepl "0.10.0-SNAPSHOT"]]}
How can I attach CIDER's debugger to this web application?
In the interest of saving time of people who have similar issue I'll post summary here as an answer. Thanks to Benedek Fazekas from
clojure-emacs/refactor-nrepl
's gitter and Sean Allred.To attach
Cider
toLuminus
application (and probably any other application which uses embeddednrepl server
as an opportunity of connecting to it while it's running) you should do two things:Provide all desired middleware as
:handler
toclojure.tools.nrepl.server/start-server
. To do this you should have libraries which contain middleware listed somewhere wherelein
can find them (e.g. inproject.clj
:dependencies
).Run application which launches embedded
nrepl server
and connectCider
to it usingcider-connect
.Beside
cider-nrepl
I want to userefactor-nrepl
which is needed by Clojure refactor. With example project from Luminus website first thing can be done like this:Then you can run your
Luminus
app withlein run
and connect it withCider
usingcider-connect
(M-x cider-connect
orC-c M-c
), by default url to connect islocalhost:7000
.Presumably, embedded
nrepl server
inLuminus
is intended to be used when application is already deployed somewhere and you want to do some live debugging. For local development there is standard way:lein repl
in the project root.Cider
will do the job withlein repl :headless
oncider-jack-in
(C-c M-j
).repl
inyourapp.core
namespace where you can run(http/start {:port 3000 :init init :handler app})
and enjoy! In this case we don't need embeddednrepl server
. To stop http server run(http/stop destroy)
. It is described here.