calva

Jack Arrington 2025-11-19T13:47:04.636669Z

What is the recommended workflow if you're using CLJ and CLJS together? I have a project using kit on the backend with deps.edn and a shadow-cljs based setup on the frontend, so I have always 2 REPLs running at once. Is there a way to quick switch between them?

👀 2
Jack Arrington 2025-11-24T06:22:21.452969Z

So, whenever I try to use shadow.cljs + deps.edn, I get this error:

This is a pseudo terminal, only used for hosting the Jack-in REPL process. It takes no input.
Pressing ctrl+c with this terminal focused, killing this terminal, or closing/reloading the VS Code window will all stop/kill the Jack-in REPL process.

DEPRECATED: Libs must be qualified, change zprint => zprint/zprint 
Downloading: cider/cider-nrepl/0.1.0-SNAPSHOT/maven-metadata.xml from clojars
Downloading: cljs-tooling/cljs-tooling/0.1.2-SNAPSHOT/maven-metadata.xml from clojars
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate nrepl/cmdline__init.class, nrepl/cmdline.clj or nrepl/cmdline.cljc on classpath.

Full report at:
/var/folders/ks/pgt5wx8n57g5vs77lbdybv1m0000gn/T/clojure-4407708882161661765.edn
Jack-in process exited. Exit code: 1
Only problem is, I'm not (directly) depending on zprint. I'm guessing one of my deps has it as a dep? Here is my full deps.edn:
{:paths   ["src/clj"
           "resources" "src/cljs"]

 :deps    {org.clojure/clojure {:mvn/version "1.12.3"}
           org.clojure/clojurescript {:mvn/version "1.11.132"}

           ;; Needed for Calva to work properly w/ dual REPL setup
           ; ;
           thheller/shadow-cljs {:mvn/version "2.18.0"}
           binaryage/devtools {:mvn/version "1.0.7"}

           ;; Routing
           metosin/reitit {:mvn/version "0.9.2"}

           ;; Ring
           metosin/ring-http-response {:mvn/version "0.9.5"}
           ring/ring-core {:mvn/version "1.15.3"}
           ring/ring-defaults {:mvn/version "0.7.0"}

           ;; Logging
           ch.qos.logback/logback-classic {:mvn/version "1.5.20"}

           ;; Data coercion
           luminus-transit/luminus-transit {:mvn/version "0.1.6"
                                            :exclusions [com.cognitect/transit-clj]}
           metosin/muuntaja {:mvn/version "0.6.11"}

           ;; kit Libs
           io.github.kit-clj/kit-core {:mvn/version "1.0.9"}
           io.github.kit-clj/kit-undertow {:mvn/version "1.0.9"}
           selmer/selmer {:mvn/version "1.12.50"}
           luminus/ring-ttl-session {:mvn/version "0.3.3"}

           ;; uix (for SSR)
           com.pitch/uix.core {:mvn/version "1.4.8"}
           com.pitch/uix.dom {:mvn/version "1.4.8"}}
 :aliases {:build {:deps {io.github.clojure/tools.build {:mvn/version "0.10.11"}
                          babashka/fs {:mvn/version "0.1.11"}
                          babashka/process {:mvn/version "0.3.11"}}
                   :ns-default build}


           :dev  {:extra-deps  {com.lambdaisland/classpath      {:mvn/version "0.6.58"}
                                criterium/criterium             {:mvn/version "0.4.6"}
                                expound/expound                 {:mvn/version "0.9.0"}
                                integrant/repl                  {:mvn/version "0.5.0"}
                                mvxcvi/cljstyle                 {:mvn/version "0.17.642"}
                                pjstadig/humane-test-output     {:mvn/version "0.11.0"}
                                ring/ring-devel                 {:mvn/version "1.15.3"}
                                ring/ring-mock                  {:mvn/version "0.6.2"}
                                io.github.kit-clj/kit-generator {:mvn/version "0.2.5"}
                                org.clojure/tools.namespace     {:mvn/version "1.5.0"}
                                dev.weavejester/hashp           {:mvn/version "0.5.1"}}
                  :extra-paths ["env/dev/clj" "env/dev/resources" "test/clj" "target/classes/cljsbuild"]}
           :nrepl {:extra-deps {nrepl/nrepl {:mvn/version "1.5.1"}
                                dev.weavejester/hashp {:mvn/version "0.5.1"}}
                   :main-opts  ["-e" "nil"
                                "-e" "((requiring-resolve 'hashp.install/install!))"
                                "-m" "nrepl.cmdline" "-i"]}
           :cider {:extra-deps {nrepl/nrepl       {:mvn/version "1.5.1"}
                                cider/cider-nrepl {:mvn/version "0.58.0"}
                                dev.weavejester/hashp {:mvn/version "0.5.1"}}
                   :main-opts  ["-e" "nil"
                                "-e" "((requiring-resolve 'hashp.install/install!))"
                                "-m" "nrepl.cmdline" "--middleware" "[cider.nrepl/cider-middleware]" "-i"]}

           :test {:extra-deps  {criterium/criterium                  {:mvn/version "0.4.6"}
                                expound/expound                      {:mvn/version "0.9.0"}
                                integrant/repl                       {:mvn/version "0.5.0"}
                                io.github.cognitect-labs/test-runner {:git/url ""
                                                                      :git/tag "v0.5.1"
                                                                      :git/sha "dfb30dd"}
                                pjstadig/humane-test-output          {:mvn/version "0.11.0"}
                                ring/ring-devel                      {:mvn/version "1.15.3"}
                                ring/ring-mock                       {:mvn/version "0.6.2"}
                                io.github.kit-clj/kit-generator      {:mvn/version "0.2.5"}
                                org.clojure/tools.namespace          {:mvn/version "1.5.0"}
                                peridot/peridot                      {:mvn/version "0.5.4"}
                                org.clj-commons/byte-streams         {:mvn/version "0.3.4"}
                                com.lambdaisland/classpath           {:mvn/version "0.6.58"}}
                  :exec-fn      cognitect.test-runner.api/test
                  :extra-paths ["env/dev/clj" "env/dev/resources" "env/test/resources" "test/clj"]
                  :main-opts   ["-e" "(require 'pjstadig.humane-test-output) (pjstadig.humane-test-output/activate!)"
                                "-m" "cognitect.test-runner"]}}}
And the full error report edn file:
{:clojure.main/message
 "Execution error (FileNotFoundException) at clojure.main/main (main.java:40).\nCould not locate nrepl/cmdline__init.class, nrepl/cmdline.clj or nrepl/cmdline.cljc on classpath.\n",
 :clojure.main/triage
 {:clojure.error/class java.io.FileNotFoundException,
  :clojure.error/line 40,
  :clojure.error/cause
  "Could not locate nrepl/cmdline__init.class, nrepl/cmdline.clj or nrepl/cmdline.cljc on classpath.",
  :clojure.error/symbol clojure.main/main,
  :clojure.error/source "main.java",
  :clojure.error/phase :execution},
 :clojure.main/trace
 {:via
  [{:type java.io.FileNotFoundException,
    :message
    "Could not locate nrepl/cmdline__init.class, nrepl/cmdline.clj or nrepl/cmdline.cljc on classpath.",
    :at [clojure.lang.RT load "RT.java" 482]}],
  :trace
  [[clojure.lang.RT load "RT.java" 482]
   [clojure.lang.RT load "RT.java" 444]
   [clojure.core$load$fn__6933 invoke "core.clj" 6189]
   [clojure.core$load invokeStatic "core.clj" 6188]
   [clojure.core$load doInvoke "core.clj" 6172]
   [clojure.lang.RestFn invoke "RestFn.java" 411]
   [clojure.core$load_one invokeStatic "core.clj" 5961]
   [clojure.core$load_one invoke "core.clj" 5956]
   [clojure.core$load_lib$fn__6875 invoke "core.clj" 6003]
   [clojure.core$load_lib invokeStatic "core.clj" 6002]
   [clojure.core$load_lib doInvoke "core.clj" 5981]
   [clojure.lang.RestFn applyTo "RestFn.java" 145]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$load_libs invokeStatic "core.clj" 6044]
   [clojure.core$load_libs doInvoke "core.clj" 6028]
   [clojure.lang.RestFn applyTo "RestFn.java" 140]
   [clojure.core$apply invokeStatic "core.clj" 669]
   [clojure.core$require invokeStatic "core.clj" 6066]
   [clojure.main$main_opt invokeStatic "main.clj" 515]
   [clojure.main$main_opt invoke "main.clj" 511]
   [clojure.main$main invokeStatic "main.clj" 665]
   [clojure.main$main doInvoke "main.clj" 617]
   [clojure.lang.RestFn applyTo "RestFn.java" 140]
   [clojure.lang.Var applyTo "Var.java" 707]
   [clojure.main main "main.java" 40]],
  :cause
  "Could not locate nrepl/cmdline__init.class, nrepl/cmdline.clj or nrepl/cmdline.cljc on classpath."}}

pez 2025-11-24T12:24:02.795169Z

The zprint could be Calva. If you have configured zprint as your pretty printer we may be injecting the dependency, i don’t quite recall, but Calva is sometimes helpful like that. 😃 As for the error. I don’t quite know. Can you share the command line you get if you use the command for copying jack-in command line? I don’t know if you are mistyping, but I recommend deps.edn + shadow-cljs. Also I recommed using ClojureScrip 1.12 and shadow-cljs 3.2.1 (or later, if exists). If you are using the :dev alias you can put shadow there. And don’t use the :cider or :nrepl aliases.

Jack Arrington 2025-11-25T16:16:41.191379Z

Output from Copy Jack-In Command Line to Clipboard:

(cd /Users/jack/Repos/repeatrr/repeatrr; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.3.0"},cider/cider-nrepl {:mvn/version,"0.1.0-SNAPSHOT"}}}' -M:dev -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware shadow.cljs.devtools.server.nrepl/middleware]")
> I don’t know if you are mistyping, but I recommend deps.edn + shadow-cljs. Yeah, sorry, deps.edn + shadow-cljs is what I meant, and the option I used. > The zprint could be Calva. If you have configured zprint as your pretty printer we may be injecting the dependency Looks like I had indeed set it to zprint at some point! Thanks for that pointer, I never would have tracked that down. When I switch it to calva, I get a fresh error about not resolving nrepl:
⚡️ Starting the REPL ⚡️ using the below command line:
(cd /Users/jack/Repos/repeatrr/repeatrr; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.3.0"},cider/cider-nrepl {:mvn/version,"0.1.0-SNAPSHOT"}}}' -M:dev -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware shadow.cljs.devtools.server.nrepl/middleware]")
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate nrepl/cmdline__init.class, nrepl/cmdline.clj or nrepl/cmdline.cljc on classpath.

Full report at:
/var/folders/ks/pgt5wx8n57g5vs77lbdybv1m0000gn/T/clojure-18424075631415174993.edn
While I can see that the jack-in command is referencing nrepl/nrepl and cider/cider-nrepl deps, I'm not selecting the :cider or :nrepl aliases (see screenshot), so I'm a bit confused as to why those are showing up?

Jack Arrington 2025-11-25T16:17:23.364139Z

And I am running clojurescript 1.11.x, will bump it to 1.12 (and shadow-cljs) per your suggestion and see if that helps 🙂

pez 2025-11-25T16:22:29.485979Z

> (cd /Users/jack/Repos/repeatrr/repeatrr; clojure -Sdeps ‘{:deps {nrepl/nrepl {:mvn/version,“0.3.0”},cider/cider-nrepl {:mvn/version,“0.1.0-SNAPSHOT”}}}’ -M:dev -m nrepl.cmdline --middleware “[cider.nrepl/cider-middleware shadow.cljs.devtools.server.nrepl/middleware]“) There was a report the other day in this channel about these ancient versions. That user was using Cursor. It was never clear if it was a Cursor-only issue, and then it started to work for some reason. @arthurfucher Do you remember if there was something we could do about it? Using qualified symbols in the lookup or something…

👍 1
Jack Arrington 2025-11-25T16:24:19.717539Z

This is in stock VSCode, not Cursor, FWIW

🙏 1
pez 2025-11-25T16:25:20.348609Z

@mail985 try with this command line: > (cd /Users/jack/Repos/repeatrr/repeatrr; clojure -Sdeps ‘{:deps {nrepl/nrepl {:mvn/version,“1.5.1”},cider/cider-nrepl {:mvn/version,“0.58.0"}}}’ -M:dev -m nrepl.cmdline --middleware “[cider.nrepl/cider-middleware]“) And then use connect instead of jack-in to connect the repl. Let us know if that works.

2025-11-25T16:25:49.171059Z

I think that the person just added fixed versions to the configuration. Maybe, one thing that we can do is to compare the "latest" version that we get with the "fixed" version from Calva. If is older than the fixed version, we use the fixed version. WDYT @pez?

pez 2025-11-25T16:26:05.650239Z

Oh, need the shadow middleware too… just a sec!

pez 2025-11-25T16:29:06.879189Z

Yes, at some point fixed versions. But also we could see in some logs that we were using unqualified symbols in the lookup and that that hit a bug in some older Clojure CLI.

pez 2025-11-25T16:29:48.072849Z

So, using fully qualified symbols + fall back on the default versions?

pez 2025-11-25T16:30:17.967049Z

@mail985 This command line:

(cd /Users/jack/Repos/repeatrr/repeatrr; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.5.1"},cider/cider-nrepl {:mvn/version,"0.58.0"}}}' -M:dev -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware shadow.cljs.devtools.server.nrepl/middleware]")

🙏 1
pez 2025-11-25T16:31:15.741739Z

You can also try with upgrading clojure on your system.

Jack Arrington 2025-11-25T16:37:09.799579Z

After upgrading shadow-cljs and clojurescript to latest and using your updated command line @pez, I instead get this error (trimmed to the relevant parts for brevity):

(cd /Users/jack/Repos/repeatrr/repeatrr; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.5.1"},cider/cider-nrepl {:mvn/version,"0.58.0"}}}' -M:dev -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware shadow.cljs.devtools.server.nrepl/middleware]")
Downloading: cider/cider-nrepl/0.58.0/cider-nrepl-0.58.0.pom from clojars
Downloading: cider/orchard/0.37.1/orchard-0.37.1.pom from clojars
Downloading: cider/orchard/0.37.1/orchard-0.37.1.jar from clojars
Downloading: cider/cider-nrepl/0.58.0/cider-nrepl-0.58.0.jar from clojars
Exception in thread "main" Syntax error macroexpanding at (uix/core.clj:1:1).

[...]

        at clojure.main.main(main.java:38)
Caused by: java.lang.UnsupportedClassVersionError: com/google/javascript/jscomp/CompilerOptions has been compiled by a more recent version of the Java Runtime (class file version 65.0), this version of the Java Runtime only recognizes class file versions up to 61.0

[...]
        
My system clojure is at latest release, but based on the above, I'm wondering if perhaps the underlying cause is that my Java runtime needs to be updated?

pez 2025-11-25T16:38:11.929519Z

I think you need to clean the project from old compiles.

👍 1
pez 2025-11-25T16:38:55.948149Z

Could be in .cpcache

pez 2025-11-25T16:39:41.977099Z

I’m also curious about your Java version 😃 Because we need clues for this strange bug.

Jack Arrington 2025-11-25T16:39:59.344749Z

java --version
openjdk 17.0.14 2025-01-21
OpenJDK Runtime Environment Temurin-17.0.14+7 (build 17.0.14+7)
OpenJDK 64-Bit Server VM Temurin-17.0.14+7 (build 17.0.14+7, mixed mode, sharing)
Looks like I am running OpenJDK v17, which I believe is a couple years out of date now

pez 2025-11-25T16:40:20.414509Z

Yeah, could be that latest ClojureScript needs 21.

👍 1
Jack Arrington 2025-11-25T16:40:50.678579Z

I'll try clearing caches and if that doesn't work, upgrade to 21 and report back

🙏 1
pez 2025-11-25T16:42:32.800839Z

Lots of moving parts here. But I think the error you got with class file versions is about Java < 21. The original bug with those ancient nrepl dependencies I do not have a clue about yet. It’s so strange…

pez 2025-11-25T16:43:55.712329Z

For completeness. It’s Shadow 3.2.1 (maybe Shadow 3.0 already) that needs ClojureScript 1.12, and this in turn needs Java 21. (Though Java 25 works great so I would start there).

👍 1
pez 2025-11-25T16:45:37.417909Z

And Shadow 3.2.1 does nothing about the original bug, I am pretty sure. But Calva works best with shadow 3.2.1 and up, so I recommend that regardless.

👍 1
Jack Arrington 2025-11-25T16:47:08.703699Z

Clearing .cpcache and target did nothing to either the compiled by a more recent version of the Java Runtime error or the weird command line with the outdated deps. Upgrading my Java version now, stdby...

Jack Arrington 2025-11-25T16:48:32.314539Z

(I'm aware the first sentence in the above is probably obvious. Just reporting all results in case it's useful in understanding what's happening / if this is a real bug and not just an error with my setup.)

pez 2025-11-25T16:49:27.323639Z

I appreciate!

pez 2025-11-25T16:51:42.810849Z

And also for completeness, and for anyone finding this convo later when searching for this kind of problem. What do you get from clojure --version?

Jack Arrington 2025-11-25T16:53:01.097259Z

❯ clojure --version
Clojure CLI version 1.12.3.1577

pez 2025-11-25T16:53:55.771539Z

I need to upgrade mine! 😃

Jack Arrington 2025-11-25T16:58:48.044989Z

Okay, we're getting somewhere! Using your manual command to launch the REPL that you provided above, and after upgrading to Java 25, I'm able to start the REPL and then use "Connect to a running REPL", and the app runs 🎉! (More or less; I am getting some weird MIME type errors where it's failing to load the compiled JS, but I can look at that later). The old deps in the command returned from Copy Jack-In Command to Clipboard are still present, though: (cd /Users/jack/Repos/repeatrr/repeatrr; clojure -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"0.3.0"},cider/cider-nrepl {:mvn/version,"0.1.0-SNAPSHOT"}}}' -M:dev -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware shadow.cljs.devtools.server.nrepl/middleware]")

pez 2025-11-25T16:59:39.455859Z

In VS Code’s developer console, you should see the clojure version printed, something like

[Extension Host] clojure version: 1.11.1.1113
You find the console from the Help menu (show developer tools or something like that).

pez 2025-11-25T17:01:18.638339Z

Thanks for the detailed report. I have a theory now about the problem. Let’s see if you find that clojure version log message.

Jack Arrington 2025-11-25T17:01:36.332239Z

Looks like 1.12.3.1577:

[Extension Host] deps.edn launcher check, executing: 'clojure --version' ...
console.ts:139 [Extension Host] deps.edn launcher check - 'clojure --version' - stdout: Clojure CLI version 1.12.3.1577
console.ts:139 [Extension Host] deps.edn launcher check - 'clojure --version' - stderr: 
console.ts:139 [Extension Host] deps.edn launcher check: 'clojure --version' command works, using 'clojure'
console.ts:139 [Extension Host] clojure version: 1.12.3.1577

pez 2025-11-25T17:01:55.609119Z

And there goes my theory. Oh, well. 😃

😆 1
🫠 1
Jack Arrington 2025-11-25T17:05:42.401019Z

I am running the latest Calva version, FWIW, though I was running a long-outdated version until a week or two ago. Crackpot theory, but I am curious if it could be some kind of cacheing issue with Calva/VSCode itself? If there is an 'extension cache' or anything like that, is there a way to clear that?

pez 2025-11-25T17:09:12.009849Z

Very good question. VS Code persisted state can get stale. I don’t know of a safe way to clear it. (ChatGPT usually suggests using nukes.) But you could download and use VS Code Insiders, which has completely separate storage for everything.

pez 2025-11-25T17:09:29.358479Z

As a way to try to validate the cache theory, at least.

👍 1
pez 2025-11-25T17:15:12.930659Z

@alexmiller would

clojure -X:deps find-versions :lib nrepl :n 1
ever return the oldest version instead of the newest? Long thread this, but we’re using command lines like that to find the latest versions for Calva’s nrepl dependencies and we seem to sometimes get the oldest instead. Though from the command line no-one has been able to reproduce, so just from VS Code child_process under unknown circumstances.

pez 2025-11-25T17:17:29.478709Z

In https://clojurians.slack.com/archives/CBE668G4R/p1763398469310569 this fixed bug was linked: https://clojure.atlassian.net/browse/TDEPS-245 But it doesn’t seem to be about that, because @mail985 has the latest version of clojure.

Jack Arrington 2025-11-25T17:25:41.827029Z

I'm going to have to step away from this until tomorrow, but I really appreciate all your help running this down @pez. If nothing else shakes out by the time I return to this then I will try with VS Code Insiders to prove/disprove the caching possibility.

pez 2025-11-25T17:27:16.867849Z

Thanks, @mail985! At least you have a workaround for now.

🙏 1
pez 2025-11-19T14:09:57.075559Z

I recommend using the deps.edn + shadow-cljs project type. Calva will automatically switch so that .cljs files evaluate things with the ClojureScript repl and .clj files use the Clojure repl. For .cljc files there is a command that toggles which repl is used. The status bar shows which repl is currently serving the file when a .cljc file is active. That indicator also is a button that executes the toggle command. It can be a bit glitchy at times, but click a few more times, if so. 😀

💡 1
Jack Arrington 2025-11-19T14:25:23.709799Z

Oooh nice. I did see the "deps.edn + shadow-cljs" option in the dropdown, but took that to mean a shadow-cljs project where you had configured your dependencies using deps.edn (which now that I say it, doesn't sound like it would be useful and is probably not possible, so not sure why I thought that)

Jack Arrington 2025-11-19T14:25:25.653699Z

Thanks!

pez 2025-11-19T14:37:42.837529Z

It means that your repl will be started by the Clojure CLI, and the shadow-cljs watcher will be started in process. This means that deps.edn needs to have the shadow-cljs dependency. 3.2.1 and up is needed for better runtime support from Calva.

👍 1
Jack Arrington 2025-11-19T14:54:44.236199Z

> This means that deps.edn needs to have the shadow-cljs dependency. As in I just need to add shadow-cljs as a dependency in my deps.edn file?

Tuomas-Matti Soikkeli 2025-11-19T15:01:02.674889Z

Does this work even if I have a figwheel project?

pez 2025-11-19T15:25:13.237029Z

Yes, the repl switching is independent of this.

🚀 1
pez 2025-11-20T09:34:09.737009Z

> As in I just need to add shadow-cljs as a dependency in my deps.edn file? Yes.

👍 1
pez 2025-11-20T09:43:40.153649Z

An alternative way to use both Clojure and ClojureScript with Calva in a shadow-cljs project is to use the shadow-cljs project type. I only recommend this if you use shadow-cljs to manage your dependencies. Because if you do deps: true or similar in shadow-cljs.edn, what will happen is that the Clojure and the ClojureScript repl will run in different processes, which (probably amongst other things) means repl tooling will not be shared.

pez 2025-11-20T10:28:50.968619Z

I probably should plug my article about how Calva uses and supports shadow-cljs: https://blog.agical.se/en/posts/shadow-cljs-clojure-cljurescript-calva-nrepl-basics/ “the basics” should be read as “the fundamentals”. In the article I try to relay how things work under the hood, from the bottom (the Clojure REPL) and up to the top (the nREPL client in Calva).

👏 4