Fork me on GitHub
#cider
<
2022-05-02
>
promesante06:05:50

hi guys, I'm trying to start a little project with shadow-clj / re-frame / emacs / cider with the re-frame template, https://github.com/day8/re-frame-template with lein. Opening the repl from within Emacs (C-c M-j) works ok, but when invoking any function, in different namespaces, I keep getting the same error reported:

Syntax error compiling at (*cider-repl flexiana/scrambler-fe:localhost:8777(clj)*:50:20).
Unable to resolve symbol: init in this context
and no Clojure / REPL related Emacs shortcut works, i.e. C-c C-k to compile and load current buffer, or C-c C-z to jump straight into REPL.

promesante07:05:57

I tried the same with the front-end / SPA module of the following little Clojure fullstack project I've taking as reference: https://github.com/lagenorhynque/clj-rest-api-and-cljs-spa-example, SPA: https://github.com/lagenorhynque/clj-rest-api-and-cljs-spa-example/tree/master/todo-app, but in that other context, I keep getting exactly the same issues described above.

promesante07:05:30

Futhermore, as I start up the SPA from CLI as explained in its README:

$ npm install
$ npx shadow-cljs watch app
the SPA works well, but when started up by starting up the REPL from Emacs (C-c M-j), the SPA runs, but reporting the following warning:
shadow-cljs - Stale Output! Your loaded JS was not produced by the running shadow-clj instance. Is the watch for this build running?

promesante07:05:50

does anybody guess what might be the reason of these issues, or what I'm doing wrong? thanks !

Volodymyr Anokhin08:05:12

If my local lein is at /usr/bin/lein and remote server has it at /opt/asdf/shims/lein and I try to jack-in into remote project (opened via tramp) I get an error

You can run the command 'cider-jack-in-clj' with SPC m '
error in process sentinel: Could not start nREPL server: /bin/sh: 1: lein: not found
I guess I can omit this if I set up asdf version of lein on my local machine, but perhaps the channel has better ideas?

1
Benjamin15:05:54

the error says lein not found I'd check which lein. I would maybe ln -s /opt/asdf/shims/lein /usr/bin

Volodymyr Anokhin16:05:47

this worked a step further but now java is not found o_O

error in process sentinel: Could not start nREPL server: /opt/asdf/installs/leiningen/2.9.8/bin/lein: line 257: type: java: not found
Leiningen couldn't find 'java' executable, which is required.
Please either set JAVA_CMD or put java (>=1.6) in your $PATH (/opt/asdf/installs/leiningen/2.9.8/bin:/bin:/usr/bin:/sbin:/usr/sbin:/usr/local/bin:/usr/local/sbin).
Will try similar approach with java

Volodymyr Anokhin16:05:46

Setting $JAVA_CMD to asdf path worked -- so if someone (or future me) has problems with cider session remote jack-in using asdf-based setup, try to experiment a bit with lein and java binaries availability.

borkdude15:05:09

I want to connect to two different CIDER nREPLs within the same project. Is that supported?

borkdude15:05:51

Usually I want to connect to the other nREPL only for one or two specific files

Hans Conrad15:05:59

I know in spacemacs clojure layer it is supported ..but not sure if it's a cider thing or something else. Oddly enough I have a similar use case like you (running babashka repl..along side my project repl)

borkdude15:05:23

@hans.conrad Yes, this is similar, but now it's a JVM REPL + a custom CLJS REPL

Hans Conrad15:05:23

neat... btw sorry looks like it is using this https://github.com/vspinu/sesman for multiple connections

borkdude15:05:56

hmm, yes, I was trying that as well...

Hans Conrad15:05:28

with sesman I can link a connection to a specific buffer

Benjamin15:05:57

(sesman-link-with-buffer
 (current-buffer)
 (assoc "babashka"
	(sesman-sessions 'CIDER)))
if you have a session called "babashka"

bozhidar20:05:02

FYI - CIDER 1.4 ("Kyiv") is out! See https://github.com/clojure-emacs/cider/releases/tag/v1.4.0 for details.

8
cider 8
jumar08:05:26

I've just updated and trying cider-undef-all It gives me this error:

#namespace[clojure-experiments.security.encryption]Syntax error compiling at (src/clojure_experiments/security/encryption.clj:48:4).
No such namespace: System
Here's the code: https://github.com/jumarko/clojure-experiments/blob/master/src/clojure_experiments/security/encryption.clj#L48 If I remove the ns and eval the buffer as usual (with the prefix) then it works again. I'm using spacemacs if that matters.

bozhidar08:05:53

Probably you've encountered some edge-case we didn't notice. Please, file an issue about this.

jumar14:05:22

@U191H9E5C @U051BLM8F that issue is I think what is happening to me.