Fork me on GitHub

Getting a weird error when running cider-jack-in-clj with a Clojure CLI deps.edn project and using an alias with the -M flag rather than the deprecated -A flag (I've tried a few aliases with the same error). I have tried this with several versions of Clojure CLI tools installed, from onwards. Using the -A flag does not give this error...

error in process sentinel: Could not start nREPL server: Execution error (FileNotFoundException) at (
-Sdeps (No such file or directory)
CIDER 1.0.0snapshot (package: <tel:202009301242|20200930.1242>) Update: In the #tools-deps channel I am asking if the -M flag has issues when the -Sdeps option is also supplied (as I cant seem to turn -Sdeps injection for cider-jack-in-clj off completely with variables in .dir-locals.el)


Root cause: When using a .dir-locals.el file to set (cider-clojure-cli-global-options . "-M:env/test") the -M flag and aliase is placed before -Sdeps when it should be placed after clojure [clj-opt*] -M[:aliases] [init-opt*] [main-opt] [arg*] -Sdeps is an clj-opt (as shown when running clojure -h in a terminal) A working command line with the -M flag and an :env/test alias should look as follows:

/usr/local/bin/clojure -Sdeps '{:deps {nrepl {:mvn/version "0.8.2"} refactor-nrepl {:mvn/version "2.5.0"} cider/cider-nrepl {:mvn/version "0.25.3"}}}' -M:env/test -m nrepl.cmdline --middleware '["refactor-nrepl.middleware/wrap-refactor", "cider.nrepl/cider-middleware"]'
The same positional rule applies for -A flag, however, the -A flag seems more flexible about following the rules. As a temporary work-around I can use the universal argument (C-u in Emacs / SPC-u in Spacemacs) before calling cider-jack-in and manually edit the command line, putting the alias in the right position. I still havent found a way to disable the -Sdeps from being injected. I can configure for an empty deps list, but have not found a way to prevent the -Sdeps option from being added, except by removing all arguments including the -M alias and -m main-namespace I'e raised an issue and see if I can figure out a PR, although I got a little lost looking at the jack-in code last time.


@jr0cket @U06KGTXL5 I suggested a potential fix in the Github issue.

👍 2
cider 1

Pull request to fix the Clojure CLI projects ordering of parameters


I am seeing the same error as @jr0cket, but using cider 20201020..1058 package


hey. how can I use cider to debug my code, I watch the doc, but found nothing I understand.


can you tell me how to operate??


another question, how to set proxy in cider, cider-jack-in failed because former proxy port is forbidden by me, and now I use a new port for proxy


eh, I am trying to debug in cider now, and I copy this code from doc:

(loop [i 0]
                  (when (< i 10)
                    (println i)
                    (recur (inc i))))
but it throws me an error that
1. Caused by java.lang.RuntimeException
   Unmatched delimiter: )
what's happening??


ps: I am sure `

{:user {:plugins [[cider/cider-nrepl "0.9.0"]]}}
has been writen in my .lein/profile.clj


that version was released in 2015.


what should I do


i can't believe it even works. remove that from lein profiles. if you use cider-jack-in CIDER now makes sure the correct dependencies are added


you mean write [cider/cider-nrepl "0.9.0"] in to my project.clj??


no. don't add anything. if you use cider-jack-in it will add it automatically. also, that version is from 2015 so you certainly shouldn't use that version in any case


but however, cider-toggle-trace-var only works when [cider/cier-nrepl] writen in .lein/profile.clj


CIDER needs cider-nrepl on the classpath. if you remove that from your lein profiles, but you use cider-jack-in CIDER will add the correct version for you on startup


/Users/dan/bin/lein update-in :dependencies conj \[nrepl\ \"0.8.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.25.3\"\] -- repl :headless :host localhost


is an example of the way that CIDER starts up a lein project. as you can see, it includes the correct recent version of cider-nrepl for all features of CIDER to work correctly


if you are starting your project in another manner then you are responsible for ensuring the dependencies are on the classpath. I'd recommend a profile and then lein with-profile +name-of-the-profile that includes the dep [cider/cider-nrepl "0.25.3"] or the most recent version of cider-nrepl


user-error: 'cider-toggle-trace-var' requires the nREPL op "toggle-trace-var" (provided by cider-nrepl)


I remove content of .lein/profile.clj


how did you start your repl?




at the top of the repl buffer do you see something like: ;; Startup: with a big command after it? can you post that?


and what is the output of lein --version ?


2.8.1 maybe it's too low


yeah. lein upgrade 2.9.4 should update it


hold on please, I install it from apt, now I want to build it from source, just for fun, can I do it??


i guess? uninstall from apt and then do what you want


wow, I solve that after upgrade leiningen, thank you

👍 1

and in general, never put stuff in lein/profiles. Use a profile in the project or let CIDER manage it for you


one more question ![image]( how can I do like this?? I copy it in my emacs, but find it not stop


and this is Startup message

;; Connected to nREPL server - 
;; CIDER 1.0.0-snapshot, nREPL 0.8.2
;; Clojure 1.8.0, Java 11.0.8
;;     Docs: (doc function-name)
;;           (find-doc part-of-name)
;;   Source: (source function-name)
;;  Javadoc: (javadoc java-object-or-class)
;;     Exit: <C-c C-q>
;;  Results: Stored in vars *1, *2, *3, an exception in *e;
;; ======================================================================
;; If you're new to CIDER it is highly recommended to go through its
;; user manual first. Type <M-x cider-view-manual> to view it.
;; In case you're seeing any warnings you should consult the manual's
;; "Troubleshooting" section.