Can anyone see the reason why this project file:
(defproject pftv "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "<http://example.com/FIXME>"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
:url "<https://www.eclipse.org/legal/epl-2.0/>"}
:dependencies [[org.clojure/clojure "1.9.0"]
[criterium "0.4.4"]]
:repl-options {:init-ns pftv.core})
With this command line: lein update-in :dependencies conj "[nrepl \"0.5.3\"]" -- update-in :plugins conj "[cider/cider-nrepl \"0.20.0\"]" -- update-in "[:repl-options :nrepl-middleware]" conj "[\"cider.nrepl/cider-middleware\"]" -- repl
Would fail like this: Error loading cider.nrepl: Syntax error compiling at (cider/nrepl.clj:1:1).
...
Exception in thread "main" Syntax error compiling var at (/private/var/folders/cs/v0sbd67j3_s93nx488j890bw0000gn/T/form-init7118680432847839889.clj:1:9206).
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7114)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
at clojure.lang.Compiler.analyze(Compiler.java:6745)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3888)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7108)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
at clojure.lang.Compiler.analyze(Compiler.java:6745)
at clojure.lang.Compiler$InvokeExpr.parse(Compiler.java:3888)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7108)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
at clojure.lang.Compiler.access$300(Compiler.java:38)
at clojure.lang.Compiler$LetExpr$Parser.parse(Compiler.java:6384)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7106)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
at clojure.lang.Compiler.analyze(Compiler.java:6745)
at clojure.lang.Compiler$BodyExpr$Parser.parse(Compiler.java:6120)
at clojure.lang.Compiler$FnMethod.parse(Compiler.java:5467)
at clojure.lang.Compiler$FnExpr.parse(Compiler.java:4029)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7104)
at clojure.lang.Compiler.analyze(Compiler.java:6789)
at clojure.lang.Compiler.eval(Compiler.java:7173)
at clojure.lang.Compiler.eval(Compiler.java:7166)
at clojure.lang.Compiler.eval(Compiler.java:7166)
at clojure.lang.Compiler.eval(Compiler.java:7166)
at clojure.lang.Compiler.load(Compiler.java:7635)
at clojure.lang.Compiler.loadFile(Compiler.java:7573)
at clojure.main$load_script.invokeStatic(main.clj:452)
at clojure.main$init_opt.invokeStatic(main.clj:454)
at clojure.main$init_opt.invoke(main.clj:454)
at clojure.main$initialize.invokeStatic(main.clj:485)
at clojure.main$null_opt.invokeStatic(main.clj:519)
at clojure.main$null_opt.invoke(main.clj:516)
at clojure.main$main.invokeStatic(main.clj:598)
at clojure.main$main.doInvoke(main.clj:561)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:37)
Caused by: java.lang.RuntimeException: Unable to resolve var: cider.nrepl/wrap-apropos in this context
at clojure.lang.Util.runtimeException(Util.java:221)
at clojure.lang.Compiler$TheVarExpr$Parser.parse(Compiler.java:720)
at clojure.lang.Compiler.analyzeSeq(Compiler.java:7106)
... 36 more
feels like something is missing.
oh, that doesn't fail for me
The background here is that I am tryin gto figure out the right jack-in command lines for Calva 2. And using nrepl 0.6.0 , cider-nrepl 0.21.1 and piggieback 0.4.0 behaves sufficiently different for the cljs repl that I would like to try use the generation before. That works nicely in my cljs test project, but then I tried with a simple clj-only project and got the above.
ah, it does with your project.clj
The above project starts smoothly if I change the command line to the latest nrepl etc.
What about my project.clj?
works for me if I remove the clojure dependency
Wow, remove it? Why did you even try that?
because of the test project.clj it happened to work on when I tried it
I get a lot of Error loading cider.nrepl: java.io.FileNotFoundException: Could not locate nrepl/middleware/pr_values__init.class or nrepl/middleware/pr_values.clj on classpath. Please check that namespaces with dashes use underscores in the Clojure file name., compiling:(cider/nrepl.clj:1:1)
on clojure 1.8.0
I tried using clojure 1.10.0, but that didn’t help. Would never have tried to remove it.
No idea why it works
So that helps with my project, but not for Calva really…
have you compared what cider generates for your project?
with an older cider version I guess?
If I remove the clojure dependency I get
Error: Could not find or load main class clojure.main
Caused by: java.lang.ClassNotFoundException: clojure.main
Subprocess failed
I can go even simpler than your example though lein update-in :plugins conj "[cider/cider-nrepl \"0.20.0\"]" -- repl
doesn't work, lein update-in :plugins conj "[cider/cider-nrepl \"0.21.0\"]" -- repl
does
And if I also remove the criterium dependency the repl starts, but before that a lot of complaints and of course my code needing criterium will not work.
You mean trying with emacs/cider? No, haven’t. I will do that now. Thing is my computer does not really like emacs, which is why Calva even exists. But I will force feed it.
I wonder if that's true if you just put it straight into the project.clj.
If what is true?
If it fails still, sorry
Does criterium depends on nrepl maybe?
I doubt it uses nrepl. But that might explain stuff. Must check.
(defproject pftv "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.8.0"]]
:plugins [[cider/cider-nrepl "0.20.0"]])
with lein repl
is brokenNo nrepl deps there…
❯ lein deps :tree
[cider/cider-nrepl "0.20.0"]
[cider/orchard "0.4.0" :exclusions [[org.clojure/clojure]]]
[org.tcrawley/dynapath "0.2.5" :exclusions [[org.clojure/clojure]]]
[cljfmt "0.6.1" :exclusions [[org.clojure/clojure] [org.clojure/clojurescript]]]
[com.googlecode.java-diff-utils/diffutils "1.3.0"]
[org.clojure/tools.cli "0.3.7"]
[rewrite-clj "0.6.0"]
[rewrite-cljs "0.4.4"]
[cljs-tooling "0.3.1" :exclusions [[org.clojure/clojure]]]
[compliment "0.3.8" :exclusions [[org.clojure/clojure]]]
[fipp "0.6.14" :exclusions [[org.clojure/clojure]]]
[org.clojure/core.rrb-vector "0.0.13"]
[mvxcvi/puget "1.0.2" :exclusions [[org.clojure/clojure]]]
[mvxcvi/arrangement "1.1.1"]
[org.clojure/java.classpath "0.3.0" :exclusions [[org.clojure/clojure]]]
[org.clojure/tools.namespace "0.3.0-alpha4" :exclusions [[org.clojure/clojure]]]
[org.clojure/tools.reader "1.2.2" :exclusions [[org.clojure/clojure]]]
[org.clojure/tools.trace "0.7.10" :exclusions [[org.clojure/clojure]]]
[thunknyc/profile "0.5.2" :exclusions [[org.clojure/clojure]]]
[clojure-complete "0.2.5" :exclusions [[org.clojure/clojure]]]
[nrepl "0.6.0" :exclusions [[org.clojure/clojure]]]
[org.clojure/clojure "1.8.0"]
Looks good to me, modern nrepl versionWeird, without cider I'm getting:
❯ lein repl
nREPL server started on port 42939 on host 127.0.0.1 - <nrepl://127.0.0.1:42939>
REPL-y 0.4.3, nREPL 0.6.0
Clojure 1.8.0
OpenJDK 64-Bit Server VM 1.8.0_202-b00
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e
user=> (require 'nrepl.middleware.pr-values)
ah, 0.6.0 doesn't have pr-values!
(defproject pftv "0.1.0-SNAPSHOT"
:dependencies [[org.clojure/clojure "1.8.0"]
[nrepl "0.5.3"]]
:plugins [[cider/cider-nrepl "0.20.0"]])
This works fine(of course, your injecting that via cli should work too, but it's not for some reasons, but now we know what is wrong)
I’ve seen complains about pr-values. What is that?
A middleware 😄
I have a suspicion that leiningen doesn't allow injecting the nrepl version via update-in
Oh, wow, that would screw me up quite a lot.
easily verified:
/tmp/foo 1 21:09:49
❯ lein update-in :dependencies conj "[nrepl \"0.5.3\"]" -- deps :treePossibly confusing dependencies found:
[nrepl "0.6.0" :exclusions [org.clojure/clojure]]
overrides
[nrepl "0.5.3"]
Consider using these exclusions:
[clojure-complete "0.2.5" :exclusions [[org.clojure/clojure]]]
[nrepl "0.6.0" :exclusions [[org.clojure/clojure]]]
[org.clojure/clojure "1.8.0"]
yeah, doesn't work 🙂
nrepl
is added to :dependencies
before update-in
has a chance to run
leiningen adds that?
yup
https://github.com/technomancy/leiningen/blob/master/project.clj#L21
just realized how crazy is it that leiningen has its own project.clj file...
OK. I would have hoped that things moved in the direction where no project includes nrepl etc , and instead the world would depend on injections.
leiningen depends on it in order to provide the lein repl
command
Yeah, it makes some sense, of course, but … Anyway, this leaves me with the only option to try figure out why Calva does not work with piggieback 0.4.0 (not sure it is piggieback that is the culprit, but the hints I have gathered so far points in that direction.
@mseddon ^ lein hardcodes nrepl 0.6.0, all bets are off ^
So, this might be the best place to ask this. With piggieback 0.4.0 (again, I think it’s piggieback) I do not get any out
or err
result messages from my eval
calls for the cljs repl. Am I supposed to look for them in some other way?
(-->
id "310"
op "eval"
session "65a5a0ee-d1f8-4fb4-ac1d-fac1df6e19c8"
time-stamp "2019-04-23 15:28:51.837145000"
code "(prn (+ 1 1))
"
column 1
file "/Users/dan/projects/aclaimant/acl/resources/public/js/app.ou..."
line 56
nrepl.middleware.print/print "cider.nrepl.pprint/pr"
nrepl.middleware.print/quota 1048576
nrepl.middleware.print/stream? nil
ns "pushy.core"
)
(<--
id "11"
session "65a5a0ee-d1f8-4fb4-ac1d-fac1df6e19c8"
time-stamp "2019-04-23 15:28:51.876571000"
out "2
"
)
(<--
id "310"
session "65a5a0ee-d1f8-4fb4-ac1d-fac1df6e19c8"
time-stamp "2019-04-23 15:28:51.882699000"
ns "pushy.core"
printed-value 1
value "nil"
)
(<--
id "310"
session "65a5a0ee-d1f8-4fb4-ac1d-fac1df6e19c8"
time-stamp "2019-04-23 15:28:51.884496000"
status ("done")
)
Also. I get this in the terminal where I started the REPL with 0.4.0:
Exception in thread "nRepl-session-8067c4a9-e320-4f8e-b84f-890c8cbf2097" java.lang.IllegalArgumentException: No implementation of method: :send of protocol: #'nrepl.transport/Transport found for class: nil
at clojure.core$_cache_protocol_fn.invokeStatic(core_deftype.clj:583)
at clojure.core$_cache_protocol_fn.invoke(core_deftype.clj:575)
at nrepl.transport$eval20664$fn__20665$G__20655__20672.invoke(transport.clj:16)
at nrepl.middleware.print$replying_PrintWriter$fn__21121.invoke(print.clj:115)
at nrepl.middleware.print.proxy$java.io.Writer$ff19274a.write(Unknown Source)
at java.io.BufferedWriter.flushBuffer(BufferedWriter.java:129)
at java.io.BufferedWriter.flush(BufferedWriter.java:253)
at java.io.PrintWriter.newLine(PrintWriter.java:482)
at java.io.PrintWriter.println(PrintWriter.java:629)
at java.io.PrintWriter.println(PrintWriter.java:757)
at java.lang.Throwable$WrappedPrintWriter.println(Throwable.java:764)
at java.lang.Throwable.printStackTrace(Throwable.java:655)
at java.lang.Throwable.printStackTrace(Throwable.java:721)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:93)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:28)
at cljs.repl$repl_caught.invokeStatic(repl.cljc:802)
at cljs.repl$repl_caught.invoke(repl.cljc:788)
at cider.piggieback$repl_caught.invokeStatic(piggieback.clj:105)
at cider.piggieback$repl_caught.invoke(piggieback.clj:98)
at cider.piggieback$do_eval.invokeStatic(piggieback.clj:265)
at cider.piggieback$do_eval.invoke(piggieback.clj:227)
at cider.piggieback$evaluate.invokeStatic(piggieback.clj:273)
at cider.piggieback$evaluate.invoke(piggieback.clj:271)
at clojure.lang.Var.invoke(Var.java:381)
at cider.piggieback$wrap_cljs_repl$fn__21926$fn__21929$fn__21930.invoke(piggieback.clj:305)
at cider.piggieback$enqueue$fn__21898.invoke(piggieback.clj:195)
at clojure.lang.AFn.run(AFn.java:22)
at nrepl.middleware.session$session_exec$main_loop__21356$fn__21360.invoke(session.clj:171)
at nrepl.middleware.session$session_exec$main_loop__21356.invoke(session.clj:170)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:748)
ooh, that's a bug
I found that one a while ago
@dpsutton. you get the out
message…. Is that with piggieback 0.4.0?
Which one did you find, @dominicm?
no it didn't show up in my repl
that exact message, @cichli fixed it though
yes 0.4.0 i believe
:nrepl-middleware ["cider.piggieback/wrap-cljs-repl"]
is present?
You get the message, but with ID 11, I haven’t looked for it with some other ID.
ah yes. longstanding bug
responds to the subscription message i believe
I think Calva users can live it for a while. But right now that error thrown kills my cljs repl client. I should of course try to make it handle that more gracefully…
the out-subscribe
I think I might want to get at the info in the out-subscribe, btw. Lots of users ask about where output from their apps go, and that would be a way to present it, right?
yes that's the way to get the out of the process back into the repl
You know where I can read about that subscription?
https://github.com/clojure-emacs/cider-nrepl/blob/master/src/cider/nrepl/middleware/out.clj#L104
this whole ns