luminus-framework/luminus

Cannot connect to shadowcljs repl

introom opened this issue · 3 comments

Steps to reproduce:

  1. lein new luminus luminus-app +re-frame +shadow-cljs +aleph
  2. lein shadow watch app
  3. shadow-cljs cljs-repl app

In step 3, we get the error:
2019-07-17 13:53:11,006 [main] INFO org.xnio - XNIO version 3.7.0.Final
2019-07-17 13:53:11,103 [main] INFO org.jboss.threads - JBoss Threads version 2.3.2.Final
2019-07-17 13:53:11,122 [main] DEBUG io.undertow - Configuring listener with protocol HTTP for interface 0.0.0.0 and port 9630
[2019-07-17 13:53:11.170 - WARNING] TCP Port 9630 in use.
2019-07-17 13:53:11,178 [main] DEBUG io.undertow - starting undertow server io.undertow.Undertow@f1b70d5
2019-07-17 13:53:11,198 [main] DEBUG io.undertow - Configuring listener with protocol HTTP for interface 0.0.0.0 and port 9631
[2019-07-17 13:53:11.722 - WARNING] :shadow.cljs.devtools.server/nrepl-ex
BindException Address already in use (Bind failed)
java.net.PlainSocketImpl.socketBind (PlainSocketImpl.java:-2)
java.net.AbstractPlainSocketImpl.bind (AbstractPlainSocketImpl.java:387)
java.net.ServerSocket.bind (ServerSocket.java:375)
java.net.ServerSocket.bind (ServerSocket.java:329)
nrepl.server/start-server (server.clj:128)
nrepl.server/start-server (server.clj:96)
shadow.cljs.devtools.server.nrepl04/start (nrepl04.clj:376)
shadow.cljs.devtools.server.nrepl04/start (nrepl04.clj:359)
clojure.lang.Var.invoke (Var.java:384)
shadow.cljs.devtools.server/start-system/fn--31019 (server.clj:331)
shadow.cljs.devtools.server/start-system (server.clj:301)
shadow.cljs.devtools.server/start-system (server.clj:242)
shadow-cljs - server version: 2.8.39 running at http://localhost:9631

If you're trying to access the cljs nrepl with shadow you should do:

lein repl :connect 7002

Or, if using an IDE that lets you connect to an nREPL, you just need to set port to 7002 and host to localhost.

Once in the REPL,

(shadow/repl :app)

Let me know if that works, or if you're trying to do something else and I misunderstood the issue.

Source: http://www.luminusweb.net/docs/clojurescript.html#developing_with_shadow-cljs

@nikolap this works.

could i directly connect to repl? that is, combining the :connect 7002 and the (shadow/repl :app) step?

also, i was following here: https://shadow-cljs.github.io/docs/UsersGuide.html#cljs-repl

$ shadow-cljs watch build-id
...

# different terminal
$ shadow-cljs cljs-repl build-id
shadow-cljs - connected to server
[3:1]~cljs.user=>

where it first uses watch, then uses cljs-repl buid-id.

I don't think you can connect directly, I forgot all the steps before, but there was always that need to switch to the cljs repl since the nrepl starts in a clojure environment...

And yeah, hm see what you mean from the shadow-cljs docs. I'll poke around later to see what prevents you from being able to do that.