hey folks! when trying to jack-in to a cljs repl (shadow-cljs), I get the following error:
[nREPL] Starting server via /Users/coetry/.nvm/versions/node/v21.7.3/bin/npx shadow-cljs -d nrepl/nrepl:1.3.1 -d cider/cider-nrepl:0.55.7 -d cider/piggieback:0.5.3 server
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: shadow-cljs - config: /Users/coetry/Hacks/Clojure/uix/shadow-cljs.edn
shadow-cljs - starting via "clojure"
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classpath.
Full report at:
/var/folders/40/cnzkzgvs2xnbz7pvhkmnkl2r0000gn/T/clojure-14696336758868201331.edn
("exited abnormally with code 1")
error in process sentinel: Could not start nREPL server: shadow-cljs - config: /Users/coetry/Hacks/Clojure/uix/shadow-cljs.edn
shadow-cljs - starting via "clojure"
Execution error (FileNotFoundException) at clojure.main/main (main.java:40).
Could not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classpath.shadow-cljs is available in my path
any ideas on how to debug further?
what does /var/folders/40/cnzkzgvs2xnbz7pvhkmnkl2r0000gn/T/clojure-14696336758868201331.edn say?
{:clojure.main/message
"Execution error (FileNotFoundException) at clojure.main/main (main.java:40).\nCould not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classpath.\n",
:clojure.main/triage
{:clojure.error/class java.io.FileNotFoundException,
:clojure.error/line 40,
:clojure.error/cause
"Could not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.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 shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.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__6931 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__6873 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 shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classwell that’s not much help. Is shadow-cljs on your classpath?
it’s looking for a namespace from it. do you have that?
i have it in my deps.edn
{:deps {org.clojure/clojure {:mvn/version "1.12.0"}
org.clojure/clojurescript {:mvn/version "1.11.60"}
com.pitch/uix.core {:mvn/version "1.4.3"}
com.pitch/uix.dom {:mvn/version "1.4.3"}}
:paths ["src"]
:aliases {:dev {:extra-deps {thheller/shadow-cljs {:mvn/version "2.28.19"}
binaryage/devtools {:mvn/version "1.0.7"}}}}}if you move that from extra deps into regular deps does it work? that would help diagnose if you are not getting dev aliases to shadow somehow. this lets us know that if you successfully get the dev alias to it it should work. then you can back it out and figure out how to pass alias information around
yeah that works
but i get this warning in the repl
Execution error (ExceptionInfo) at shadow.cljs.devtools.server.nrepl/shadow-cljs-repl (nrepl.clj:33).
shadow-cljs nREPL initialization failure!
Your nREPL client sent a wrong parameter. A keyword specifying the build-id is expected.
Instead got a #cljs.repl.browser.BrowserEnv{:es #object[java.util.concurrent.ThreadPoolExecutor 0x2c589ced "java.util.concurrent.ThreadPoolExecutor@2c589ced[Running, pool size = 0, active threads = 0, queued tasks = 0, completed tasks = 0]"], :browser-state #atom[{:return-value-fn nil, :client-js nil}], :working-dir ".repl-1.11.60", :preloaded-libs [], :launch-browser true, :static-dir ["." "out/"], :src "src/", :port 9000, :ordering #agent[{:expecting nil, :fns {}}], :host "localhost", :server-state #atom[{:socket nil, :listeners 0}]}no idea on that one
got it, wonder why my dev alias isn’t firing properly
{:deps true
:dev-http {8080 "public"}
:builds {:app
{:target :browser
:modules {:main {:entries [app.core]
:init-fn app.core/init}}
:devtools {:preloads [uix.preload devtools.preload]}}}}that’s my shadow-cljs.edn its a minimal starter template, not much going on there
i think you can include alias informatoin there
{:deps {:aliases [:cljs]}
:builds ...}shadow-cljs.edn
{:deps {:aliases [:dev]}
:dev-http {8080 "public"}
:builds {:app
{:target :browser
:modules {:main {:entries [app.core]
:init-fn app.core/init}}
:devtools {:preloads [uix.preload]}}}}
deps.edn
{:deps {org.clojure/clojure {:mvn/version "1.12.0"}
org.clojure/clojurescript {:mvn/version "1.11.60"}
com.pitch/uix.core {:mvn/version "1.4.3"}
com.pitch/uix.dom {:mvn/version "1.4.3"}}
:paths ["src"]
:aliases {:dev {:extra-deps {thheller/shadow-cljs {:mvn/version "2.28.19"}
binaryage/devtools {:mvn/version "1.0.7"}}}}does that look correct? Still getting problems with that config, it only works if i put it under main :deps
I’d suggest getting this all working without cider tooling. Helps simplify and identify where the issue is
looks like its working now (i ran it in vscode calva and it said i had a parsing error in my deps.edn — fixed it and it works now from cider)
thanks for your help!
gratitude
nice!
yeah. CIDER is helpful but when things are working, sometimes it’s hard to get clear error messages since you have docs for shadow-cljs, deps.edn, CIDER, clojure-mode, emacs, etc. removing the middlement for debugging is very helpful