我同时拥有cognitect.transit-clj
和cognitect.transit-cljs
依赖项,因为我的项目是后端的 Clojure 和前端的 CLJS。我正在使用 .cider 连接到苹果酒中的 shadow-cljs repl cider-connect
。
在repl中,我这样做:
(require '[cognitect.transit :as xit])
(def my-writer (xit/writer :json))
我收到此错误:
Execution error (ArityException) at nrepl.middleware.interruptible-eval/evaluate$fn (interruptible_eval.clj:91).
Wrong number of args (1) passed to: cognitect.transit/writer
它似乎正在尝试调用transmit/writer
. 我的依赖项或设置有问题吗?
这是完整的堆栈跟踪:
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)