This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-09-01
Channels
- # adventofcode (2)
- # announcements (3)
- # babashka-sci-dev (79)
- # beginners (76)
- # biff (2)
- # calva (32)
- # cider (2)
- # clj-kondo (42)
- # clj-on-windows (17)
- # clojure (28)
- # clojure-belgium (1)
- # clojure-berlin (1)
- # clojure-europe (95)
- # clojure-nl (4)
- # clojure-norway (4)
- # clojure-uk (5)
- # clojurescript (27)
- # conjure (5)
- # cursive (3)
- # data-science (16)
- # datomic (67)
- # graalvm (12)
- # hyperfiddle (36)
- # jobs (3)
- # jobs-discuss (1)
- # kaocha (2)
- # klipse (1)
- # leiningen (28)
- # lsp (16)
- # luminus (3)
- # malli (10)
- # nrepl (3)
- # off-topic (57)
- # other-languages (18)
- # re-frame (4)
- # reitit (8)
- # releases (1)
- # remote-jobs (1)
- # scittle (4)
- # shadow-cljs (7)
- # test-check (1)
- # tools-deps (4)
- # vim (11)
- # xtdb (25)
Can’t figure out why I can’t get my repl running in calva for this skeleton project: https://github.com/jointprob/jointprob-shadow-cljs
I jack in and the build seems to work:
npx shadow-cljs -d cider/cider-nrepl:0.28.5 watch :my-build-id
shadow-cljs - config: /Users/jamespratt/IdeaProjects/jointprob-shadow-cljs/shadow-cljs.edn
shadow-cljs - server version: 2.19.9 running at
shadow-cljs - nREPL server started on port 49410
shadow-cljs - watching build :my-build-id
[:my-build-id] Configuring build.
[:my-build-id] Compiling ...
[:my-build-id] Build completed. (127 files, 0 compiled, 0 warnings, 1.16s)
I get this as REPL output:
; Jacking in...
; Starting Jack-in Terminal: npx shadow-cljs -d cider/cider-nrepl:0.28.5 watch :my-build-id
; Hooking up nREPL sessions...
; Connected session: clj
; TIPS:
; - You can edit the contents here. Use it as a REPL if you like.
; -
alt+enter` evaluates the current top level form.`
; -
ctrl+enter` evaluates the current form.`
; -
alt+up` and alt+down
traverse up and down the REPL command history`
; when the cursor is after the last contents at the prompt
; - Clojure lines in stack traces are peekable and clickable.
clj꞉shadow.user꞉>
; Creating cljs repl session...
; Connecting cljs repl: shadow-cljs...
; The Calva Connection Log might have more connection progress information.
I open : http://localhost:9630/index.html Manually in Chrome. The js alert does not appear.
I select to connect to :my-build-id
get more output in repl window:
; Creating cljs repl session...
; Connecting cljs repl: shadow-cljs...
; The Calva Connection Log might have more connection progress information.
; Connected session: cljs, repl: :my-build-id
; TIPS: You can choose which REPL to use (clj or cljs):
; *Calva: Toggle REPL connection*
; (There is a button in the status bar for this)
; Jack-in done.
cljs꞉cljs.user꞉>
Enter: (+ 1 1) And get: nil ; No available JS runtime. ; See https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshooting
I’m not properly connecting the client it seems.
This what I see at http://localhost:9630/index.html
More info in case it helps. At : http://localhost:9630/dashboard The green light next to my-build-id does not come on unless I press the force compile button.
I'm afk. I can only advice to experiment without Calva first. The other day I published a small test project that helps with this a bit, see if the README there makes enough sense to you to help remove Calva from the initial investigation. https://clojureverse.org/t/demystifying-shadow-cljs-nrepl-connect/9277
Thanks @U0ETXRFEW!
Thanks, it turned out that Calva was working fine. I had missed some settings for shadow-cljs
Hello Calva-friends! Coming back from vacation, and Calva doesn't pick up the nRepl port (I start shadow-cljs from an outside terminal). Did something change while I was summering? 😄
Could be a regression. I've been touching those parts of Calva a bit. Which project type are you using when connecting?
> ls -l .shadow-cljs/
total 48
drwxr-xr-x 3 orestis staff 96 Jul 5 09:38 babel-worker
drwxr-xr-x 4 orestis staff 128 Jul 5 09:38 builds
-rw-r--r-- 1 orestis staff 5 Sep 1 13:14 cli-repl.port
-rw-r--r-- 1 orestis staff 4 Sep 1 13:14 http.port
drwxr-xr-x 344 orestis staff 11008 Sep 1 13:14 jar-manifest
-rw-r--r-- 1 orestis staff 5 Sep 1 13:14 nrepl.port
-rw-r--r-- 1 orestis staff 5 Sep 1 13:14 server.pid
-rw-r--r-- 1 orestis staff 36 Sep 1 13:14 server.token
-rw-r--r-- 1 orestis staff 5 Sep 1 13:14 socket-repl.port
Indeed plain shadow-cljs works, I was always using the other as I rely on deps.edn for dependenies. What is the difference between shadow-cljs and deps.edn + shadow-cljs?
> Just for clarifying, the nrepl.port file is there. Then it should work. Which version of Calva are you using?
> What is the difference between shadow-cljs and deps.edn + shadow-cljs? Very good question. Here's a repository trying to shed some light: https://github.com/PEZ/shadow-w-backend. @danielamber2 and I have recorded a video where we elaborate on it more and I have written a quite lengthy blog article as well, which I will publish when the video has passed post-production. Stay tuned!
That's a good way to put it. The project type is associated with a launch command builder and a connect sequence. The connect sequence has a Clojure part and a ClojureScript part. The Clojure part starts with using the command builder to start the REPL with the needed dependencies, middleware configuration, and app start expression. It can also specify an expression to evaluate once the Clojure REPL is started. When this is done, the ClojureScript part is used to start and connect the ClojureScript REPL. This is all done by evaluating a series of forms on the Clojure REPL.
The project types shadow-cljs and deps.ebn + shadow-cljs differ mainly in what command line is used to start the REPL. The reason they get to be extra equivalent in your case there is that you have configured shadow-cljs to in turn start the REPL using clojure
. However, which executable is used also determines which tool starts the nREPL server.
As for your original error there, shadow-cljs
and clojure
create their nrepl port files in different places, with different names. Calva looks for a .nrepl-port
file in the project root for deps.edn
launches, and for a .shadow-cljs/nrepl.port
, if it is a shadow-cljs
launch. I'm still puzzled why the deps.edn launch didn't work for you. Which version of Calva are you using?
Ah ok, so In my case I actually use shadow-cljs to start the nrepl server (not with the shadow executable, but with the equivalent API call).
So the nrepl port file is where shadow puts it. It is just that it used to work before but got more strict later. No worries, by your description the behavior is correct.
Iirc, you can specify the nrepl port file as part of a custom connect sequence. I’m afk and can't confirm.
> What is the difference between shadow-cljs and deps.edn + shadow-cljs? Very good question. Here's a repository trying to shed some light: https://github.com/PEZ/shadow-w-backend. @danielamber2 and I have recorded a video where we elaborate on it more and I have written a quite lengthy blog article as well, which I will publish when the video has passed post-production. Stay tuned!