This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-07-06
Channels
- # aleph (1)
- # announcements (3)
- # asami (32)
- # aws (12)
- # babashka (6)
- # beginners (43)
- # calva (36)
- # cider (3)
- # clj-kondo (3)
- # cljs-dev (2)
- # clojars (6)
- # clojure (66)
- # clojure-europe (14)
- # clojure-uk (2)
- # clojurescript (12)
- # conjure (1)
- # core-async (27)
- # cursive (17)
- # data-science (9)
- # datahike (1)
- # datomic (28)
- # emacs (34)
- # events (1)
- # girouette (3)
- # jobs (1)
- # klipse (4)
- # lsp (26)
- # malli (5)
- # off-topic (38)
- # portal (1)
- # releases (1)
- # shadow-cljs (72)
- # sql (7)
- # tools-deps (5)
- # vim (9)
- # xtdb (18)
I’m having this when trying to connect deps.edn + shadow-cljs, any tip on why this might be happening?
Execution error (FileNotFoundException) at user/eval5511 (REPL:1).
Could not locate shadow/cljs/devtools/api__init.class, shadow/cljs/devtools/api.clj or shadow/cljs/devtools/api.cljc on classpath.
I also tried to add shadow-cljs as dep on deps.ednI see this on the repl output
Failed starting cljs repl for build: :grid-matrix. Is the build running and connected?
what does it mean the build is not running? Sorry, I am quite new to the cljs ecosystem 😅I also have
hadow-cljs cljs-repl grid-matrix
running on a terminal, but even though it still doesn’t workBuild is a shadow-cljs term in this case. You declare them in shadow-cljs.edn
. And that last command you pasted there starts it giving you a ClojureScript REPL. The build needs somewhere to run, which could be the browser or node. (Not sure where yours is intended to run?) When it is started and running, the REPL can be connected.
If you can share your shadow-cljs.edn
config here, it'll be easier to try help with how to get Calva connected.
Mine is intended to run in browser
{:deps {:aliases [:cljs]}
:dev-http {8000 "resources/public/grid_matrix/"}
:builds {:grid-matrix {:output-dir "resources/public/grid_matrix/assets/js/"
:asset-path "assets/js"
:target :browser
:modules {:main {:init-fn hangar.bots.grid-matrix.ui.main/main!}}
:devtools {:after-load hangar.bots.grid-matrix.ui.main/reload!}}}}
and deps edn:
:aliases
{:cljs {:deps {thheller/shadow-cljs {:mvn/version "2.19.5"}
reagent/reagent {:mvn/version "1.1.1"}
re-echarts/re-echarts {:mvn/version "5.2.1"}}}}
So, it seems that if I only start a shadow-cljs repl then it works fine, it just fails when doing deps.edn + shadow-cljs. The shadow-cljs one worked by stopping the watch and cljs-repl on my terminal, as the shadow-cljs repl seem to be doing the same
Interesting…If I start only the shadow-cljs “repl”, it actually works and can also work on .clj files normally. this is what I’d have expected for deps.edn + shadow-cljs, maybe I am missing something?
Yeah, the naming of these are a bit confusing. It trips people up often. But we haven't figured out a naming that is less confusing yet. Anyway, the shadow-cljs project type means that shadow-cljs will take care of launching the REPL. (Then you have configured shadow-cljs to use clojure/deps.edn to launch the Clojure REPL.) I wanted to suggest that you went this way, but needed to see the config first.
btw: Are you letting Calva start the REPL or are you starting it yourself and then connecting?
I see, so shadow-cljs is starting a cli repl as i have it configured to use deps.edn, it makes sense
Hi, so I’m trying to do it with deps.edn + shadow-cljs repl, because otherwise I can’t select the deps.edn aliases to use on the clj repl, but I am having the previous problem. Right now I don’t have the build watch or any shadow-cljs command running, and when I try to open both repls I get “Socket Closed” on the output
I changed the shadow-cljs config so now it’s not referring to deps.edn, now it’s like this:
{:dependencies [[reagent "1.1.1"]
[re-echarts "5.2.1"]]
:source-paths ["src"]
:dev-http {8000 "resources/public/grid_matrix/"}
:builds {:grid-matrix {:output-dir "resources/public/grid_matrix/assets/js/"
:asset-path "assets/js"
:target :browser
:modules {:main {:init-fn hangar.bots.grid-matrix.ui.main/main!}}
:devtools {:after-load hangar.bots.grid-matrix.ui.main/reload!}}}}
I wanted to avoid that, as then I wouldn’t be able to dynamically select aliases on jack-in calva, and instead would populate shadow-cljs with dev-time aliases
Shadow just passes the stresses to clojure
. You can see this early in the jackIn terminal output.
This is my current log when trying to open both repls
Starting Jack-in Terminal: clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.9.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -M:shadow-cljs:deploy:bench:profile:portal:full-stack-traces -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]"
; 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꞉user꞉>
; Creating cljs repl session...
; Connecting cljs repl: deps.edn + shadow-cljs...
; The Calva Connection Log might have more connection progress information.
; Failed starting cljs repl for build: :grid-matrix. Is the build running and connected?
See the Output channel "Calv
I haven’t quite figured out the prerequisites here. In another thread @U94V75LDV posted an example project that we got working. I’m afk so can't search good… might have been done two weeks ago. See if that one helps. Also, try going as simple as you can to begin with. Maybe we should make an example project out of @U94V75LDV ‘s repo…
Thanks, I'm afk too but next Ill try a barebones deps + shadowcljs project and see if that works
We're starting to use the configuration that we worked on our project (~ transposed what's in https://github.com/lambdam/clojure-fullstack-ssr-template to the private fullstack project) with the UI designer and it's working well. For information, the template is using shadow-cljs as a deps.edn library, not a Node.js standalone executable : https://shadow-cljs.github.io/docs/UsersGuide.html#deps-edn The intention is to have one JVM running for both backend and frontend code (even though I don't exactly know if there are two instances of the JVM running when using the Node shadow-cljs along executable with Clojure CLI since I never tried it).
I had a look at the repo, but I think it doesn’t solve what I am trying to achieve, because it needs to specify which deps.edn aliases to load from shadow-cljs.edn. I’d like to avoid that, as I prefer to select those aliases from the Jack-In command when launching the REPL from Calva (as I might want to select different ones each time, I have some user-level aliases like bench for criterium, profile for clj-async-profile, etc…). I think what I might be looking at is a bit of the opposite, instead of shadow-cljs launching the deps.edn REPL, I’d like the clj repl to watch and run the cljs repl and connect to it, if that makes sense?. I have setup this small repo https://github.com/bortexz/deps-shadow-skeleton In the backend/app there is code to start! and watch shadow-cljs (usually this would be on dev/). After starting only a deps.edn REPL from Calva, and then if I run “Calva: Select CLJS Build connection” it fails with “Socket Closed”. This is the same error I get if I try starting a deps.edn + shadow-cljs repl when opening a calva repl, so I suspect that this repl sequence might be starting a CLJ repl, followed by “Calva: Select CLJS Build connection”.
I have moved the starting of cljs to dev/user.clj, My workflow is to start only clj repl, but with aliases of cljs, and then run start-cljs on dev/user.clj . I’d hope that when the watch starts, to be able to connect to a new repl, but doesn’t seem to work, I’m always getting Socket Closed
@U94V75LDV Sorry I have realized you can actually select any aliases on the REPL you run manually, so you can do what I actually wanted to do. It works on your project, so It’s a start. I’m, wondering, is there any chance to have that as a ConnectREPLSequence where you can select the alises? I’d love to have this workflow but letting Calva start the repl for me
The only missing bit from the Calva repl command on deps.edn project type is shadow.cljs.devtools.server.nrepl/middleware
, maybe doing deps.edn + shadow.cljs should add this middleware, instead of trying to open both deps.edn and shadow-cljs repls independently? It looks like the step each other and that’s why you get Socket Closed
Think I’ve stepped on a known issue : https://github.com/BetterThanTomorrow/calva/issues/1307 and https://github.com/BetterThanTomorrow/calva/issues/1285
I’ve adapted https://github.com/bortexz/deps-shadow-skeleton , added the nrepl commands as an alias, also with a simple custom repl connect sequence similar to @U94V75LDV project’s one, now I can start the repl with Calva (JackIn) and select other aliases I want from my user profile. Only thing left would be to be able to select which build to use, but I am pretty happy with current state and to specify a custom build I can just add some code on user to take build from a constant there. Thanks for all the help @U0ETXRFEW and @U94V75LDV and apologies for the flood of messages 😅
I wonder if it would be possible to show some sort of indication of a running evaluation in the repl tab. Sometimes I eval something that takes a while to finish and then wonder whether it's still running (if you eval the same expression multiple times, the return value from the previous run may still be displayed)
There’s an issue about this on GitHub. See if you can find it and if the suggestions there make sense. I don’t recognize the last thing you mention, so please add that to the issue.
Here’s the issue: https://github.com/BetterThanTomorrow/calva/issues/1543