shadow-cljs 2026-03-04

I am running watch on my :dev build id, and connecting Cursive nrepl to .shadow_cljs/nrepl.port and trying to start a cljs repl from there. Running (shadow.cljs.devtools.api/repl :dev) gives me a ClassNotFoundException

✅ 1

my mistake it is shadow-cljs/nrepl.port

and also my mistake, I changed my cursive settings to explicitly use that port file instead of "use standard port file", it was definitely choosing the wrong port file

Which class is not found? Do you require shadow.cljs.devtools.api first?

(require 'shadow.cljs.devtools.api)
;; Could not locate shadow/cljs/devtools/api__init.class, shadow/cljs/devtools/api.clj or shadow/cljs/devtools/api.cljc on classpath.

According to https://shadow-cljs.github.io/docs/UsersGuide.html#_calling_watch_via_clj_run "By default the functions called by clj-run only have access to a minimal shadow-cljs runtime which is enough to run compile, release and any other Clojure functionality. The JVM will terminate when your function completes." How are you running watch mode?

good catch thanks for the link

currently using lein run -m shadow.cljs.devtools.cli watch dev on our project

not sure where to work in this :shadow/requires-server option

At this point you've gone beyond my minimal knowledge so... 🙂

🙏 1

.shadow_repl/nrepl.port that is not a file that is ever created by shadow-cljs? did you set that manually? it should be .shadow-cljs/nrepl.port? only reason I can think of that namespace not being found is it not being on the classpath, which is kinda impossible if you are actually connected to the watch process. so I'm guessing are you connected to some other nrepl server?

:shadow/requires-server is only relevant for run command line, which you are not using here

that would be lein run -m shadow.cljs.devtools.cli run ... (or the clj variant)

note that lein generally also write a port file, so if you didn't specify to use the correct one from shadow-cljs, it may just be falling back to a lein repl running somewhere. if you are using profiles, that may not have shadow-cljs active?