I have both the cognitect.transit-clj
and cognitect.transit-cljs
dependencies because my project is Clojure on the backend and CLJS on the frontend. I'm connecting to a shadow-cljs repl in cider with cider-connect
.
In the repl, I do:
(require '[cognitect.transit :as xit])
(def my-writer (xit/writer :json))
I get this error:
Execution error (ArityException) at nrepl.middleware.interruptible-eval/evaluate$fn (interruptible_eval.clj:91).
Wrong number of args (1) passed to: cognitect.transit/writer
It appears that it's trying to invoke the java version of transmit/writer
. Is something wrong with my dependencies or setup?
Here's the full stack trace:
clojure.lang.Compiler$CompilerException: Syntax error macroexpanding at (NO_SOURCE_FILE:45:29).
#:clojure.error{:phase :execution, :line 45, :column 29, :source "NO_SOURCE_FILE"}
at clojure.lang.Compiler$InvokeExpr.eval (Compiler.java:3707)
clojure.lang.Compiler$DefExpr.eval (Compiler.java:457)
clojure.lang.Compiler.eval (Compiler.java:7182)
clojure.lang.Compiler.eval (Compiler.java:7132)
clojure.core$eval.invokeStatic (core.clj:3214)
clojure.core$eval.invoke (core.clj:3210)
nrepl.middleware.interruptible_eval$evaluate$fn__42793.invoke (interruptible_eval.clj:91)
clojure.main$repl$read_eval_print__9086$fn__9089.invoke (main.clj:437)
clojure.main$repl$read_eval_print__9086.invoke (main.clj:437)
clojure.main$repl$fn__9095.invoke (main.clj:458)
clojure.main$repl.invokeStatic (main.clj:458)
clojure.main$repl.doInvoke (main.clj:368)
clojure.lang.RestFn.invoke (RestFn.java:1523)
nrepl.middleware.interruptible_eval$evaluate.invokeStatic (interruptible_eval.clj:84)
nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:56)
nrepl.middleware.interruptible_eval$interruptible_eval$fn__42819$fn__42823.invoke (interruptible_eval.clj:155)
clojure.lang.AFn.run (AFn.java:22)
nrepl.middleware.session$session_exec$main_loop__43068$fn__43072.invoke (session.clj:190)
nrepl.middleware.session$session_exec$main_loop__43068.invoke (session.clj:189)
clojure.lang.AFn.run (AFn.java:22)
java.lang.Thread.run (Thread.java:748)
Caused by: clojure.lang.ArityException: Wrong number of args (1) passed to: cognitect.transit/writer
at clojure.lang.AFn.throwArity (AFn.java:429)
clojure.lang.AFn.invoke (AFn.java:32)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.lang.Compiler$InvokeExpr.eval (Compiler.java:3702)
clojure.lang.Compiler$DefExpr.eval (Compiler.java:457)
clojure.lang.Compiler.eval (Compiler.java:7182)
clojure.lang.Compiler.eval (Compiler.java:7132)
clojure.core$eval.invokeStatic (core.clj:3214)
clojure.core$eval.invoke (core.clj:3210)
nrepl.middleware.interruptible_eval$evaluate$fn__42793.invoke (interruptible_eval.clj:91)
clojure.main$repl$read_eval_print__9086$fn__9089.invoke (main.clj:437)
clojure.main$repl$read_eval_print__9086.invoke (main.clj:437)
clojure.main$repl$fn__9095.invoke (main.clj:458)
clojure.main$repl.invokeStatic (main.clj:458)
clojure.main$repl.doInvoke (main.clj:368)
clojure.lang.RestFn.invoke (RestFn.java:1523)
nrepl.middleware.interruptible_eval$evaluate.invokeStatic (interruptible_eval.clj:84)
nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:56)
nrepl.middleware.interruptible_eval$interruptible_eval$fn__42819$fn__42823.invoke (interruptible_eval.clj:155)
clojure.lang.AFn.run (AFn.java:22)
nrepl.middleware.session$session_exec$main_loop__43068$fn__43072.invoke (session.clj:190)
nrepl.middleware.session$session_exec$main_loop__43068.invoke (session.clj:189)
clojure.lang.AFn.run (AFn.java:22)
java.lang.Thread.run (Thread.java:748)
I do not know enough about
cider-connect
but it is very likely that you are just connected to the CLJ REPL and not the actual CLJS REPL you are looking for. A connection always starts out as CLJ and your editor has to "upgrade" it to CLJS. Maybe this is still current?For plain shadow-cljs you get to the CLJS REPL directly via
shadow-cljs cljs-repl app
(assuming:app
is your build id). For nREPL your editor is in control. I'm sure there is a command for that.