nREPL hangs trying to connect to a Luminus project
steps to reproduce
- create a new project with
lein new luminus myapp - run the project with
lein run, this will start nREPL on port7000 - open a namespace from the project in LT and try to do add connection nREPL on
localhost:7000
The Connecting... message appears and hangs, no errors appear.
However, I'm able to start a REPL from LT without problems.
Hi yogthos. When I try this on osx 10.10, I don't get a hang but instead a connection to a new process (which isn't correct). When I do a remote connection via lein repl, I'm able to correctly communicate with the server process via lein's nrepl server and can run start-app. Are you aware of any differences b/n luminus' nrepl server and lein's? Nothing immediately pops out. I don't have cycles to dig deeper but happy to answer any LT questions if you're interested in looking further into this
Beat me to it, I was about to mention that the steps to reproduce didn't take into account the need to add lein-light-nrepl and nrepl-options to project.clj
Yeah, I'm a bit stumped on this one as well. The nrepl started by luminus should be pretty standard and cursive connects just fine, and I can connect by running lein repl :connect 7000 as well. What's the relationship of lein-light-nrepl and nrepl-options to the app starting the repl though. Wouldn't that be happening on LT end?
For a given port and host, LT opens a connection to a nrepl client. The lein-light-nrepl middleware entry fn is lighttable-ops. Two possible reasons for why the luminus nrepl server has different behavior: different tools.nrepl version or some of the server options as nil values is causing different behavior than lein's options
I think it's most likely the tools.nrepl version. I tried adding lein-light-nrepl and nrepl-options, but that didn't have any effect. The only option I pass in by default is the repl port here, and I tried adding the same ones as lein does, but that doesn't seem to help either.
Also having this issue.
Added: [lein-light-nrepl "0.3.3"] to :project/dev :dependencies and :repl-options {:nrepl-middleware [lighttable.nrepl.handler/lighttable-ops]} (see project.clj file).

Trying to directly connect with lein also results in an error. This may or may not be related:
→ lein repl :connect http://localhost:7000
Connecting to nREPL at http://localhost:7000
NoHttpResponseException localhost:7000 failed to respond
For lein repl, it should just be lein repl :connect localhost:7000 without http://.
Had the same issue – could finally connect to the nrepl server when I explicitly specified the Light Table handler for nrepl in repl-server in the core ns of my app:
(ns myapp.core
(:require [luminus.repl-server :as repl]
[lighttable.nrepl.handler :refer [lighttable-ops]]
[clojure.tools.nrepl.server :as nrepl]
...))
(mount/defstate ^{:on-reload :noop}
repl-server
:start
(when-let [nrepl-port (env :nrepl-port)]
(repl/start
{:port nrepl-port
:handler (nrepl/default-handler #'lighttable-ops)}))
:stop
(when repl-server
(repl/stop repl-server)))
Hope this helps.
I have the same issue. I tried on Ubuntu and Windows. I got the same issue. After hours of trying to connect it's still trying.
I have the same issue. I tried on Ubuntu and Windows. I got the same issue. After hours of trying to connect it's still trying.
@nenadmitrovic https://stackoverflow.com/a/55662215/6587655