shadow-cljs

shaunlebron 2026-03-04T20:50:57.185939Z

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
shaunlebron 2026-03-05T21:33:50.562119Z

my mistake it is shadow-cljs/nrepl.port

shaunlebron 2026-03-05T21:38:41.024959Z

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

seancorfield 2026-03-04T21:03:10.239949Z

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

shaunlebron 2026-03-04T21:09:32.700189Z

(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.

seancorfield 2026-03-04T21:14:10.495289Z

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?

shaunlebron 2026-03-04T21:15:50.915139Z

good catch thanks for the link

shaunlebron 2026-03-04T21:16:01.916669Z

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

shaunlebron 2026-03-04T21:22:00.118929Z

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

seancorfield 2026-03-04T21:35:11.746699Z

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

🙏 1
thheller 2026-03-05T06:35:00.305499Z

.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?

thheller 2026-03-05T06:35:41.980739Z

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

thheller 2026-03-05T06:36:26.652759Z

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

thheller 2026-03-05T07:06:47.190639Z

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?