Fork me on GitHub
Yehonathan Sharvit06:07:25

I’d like to connect Conjure to a shadow-cljs node REPL

Yehonathan Sharvit18:07:23

I knew how to make it work with a browser. My question was related to node.js. It was not clear to me that I had to run node manually. Now that I think about it, it makes sense.


Ah okay! Didn't realise the context.

Yehonathan Sharvit06:07:36

Here is what I tried

Yehonathan Sharvit06:07:00

;; shadow-cljs.edn

 [[cider/cider-nrepl "0.24.0"]]

 {:app {:target :node-script
        :main screenshot-demo.core/main
        :output-to "out/app/script.js"}}}

Yehonathan Sharvit06:07:16

shadow-cljs node-repl app
shadow-cljs - config: /Users/viebel/prj/screenshot-demo-cljs/shadow-cljs.edn
shadow-cljs - server version: 2.19.6 running at 
shadow-cljs - nREPL server started on port 57235
And in another terminal
shadow-cljs watch app
shadow-cljs - config: /Users/viebel/prj/screenshot-demo-cljs/shadow-cljs.edn
[2022-07-22 09:42:04.331 - WARNING] TCP Port 9630 in use.
shadow-cljs - server version: 2.19.6 running at 
shadow-cljs - nREPL server started on port 58699
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build completed. (81 files, 0 compiled, 0 warnings, 2.09s)

Yehonathan Sharvit06:07:33

:ConjureConnect 58699
:ConjureShadowSelect app

Yehonathan Sharvit06:07:27

And it shows

; shadow-cljs (select): app
; (out) To quit, type: :cljs/quit
[:selected :app]

Yehonathan Sharvit06:07:20

But when I am trying to eval js code in nvim (e.g (js/console.log "aaa") ), I am getting this error:

; eval (current-form): (js/console.log "aaa")
; (err) No available JS runtime.
; (err) See 


you must run the compiled file


node out/app/script.js

Yehonathan Sharvit09:07:04

@huxley Why do I need shadow-cljs node-repl app then?


I didn't notice that

Yehonathan Sharvit09:07:03

You mean that it’s not required?


I usually just fire up the app


And everything works

Yehonathan Sharvit09:07:06

Is there a way to connect a command line CLJS REPL to the app ?


unfortunately I have never used command line repl


so I can't help

Yehonathan Sharvit09:07:17

OK. You have already helped a lot

😊 1

The potential problem I see is that the shadow-cljs node-repl app is creating a different nrepl port number than what you are connecting to with shadow-cljs watch app (e.g. port 57235 vs 58699). Now I don't know how to resolve that issue for what you are looking to do but just thought I would point it out in case you hadn't noticed.


@viebel We have a couple of AWS Lambdas at work that use shadow-cljs on Node. Here are the steps I do with NeoVim/Conjure: • in one terminal window (tmux panefor me): shadow-cljs server • in another terminal window: shadow-cljs watch dev (or app in your case) • in another terminal window: node target/dev/dev.js (where the path is the path to your compiled app JS file) • in Neovim: :ConjureShadowSelect dev

👍 1

it is a bit ugly, but it works for me to get a repl connection…


The next time I touch that project there is going to be a Makefile targets so we can use the same commands across all microservice projects, then with that it is just set that up in a tmuxinator profile that does that dance across all the various Tmux windows and panes

Yehonathan Sharvit13:07:50

@steven.proctor I was able to make it work as @huxley suggested, without shadow-cljs server.

Yehonathan Sharvit13:07:59

Why do you need shadow-cljs server for?


I don’t need it, but it get shadow running once, then every shadow command after goes faster


there are times when I would have to restart the shadow-cljs watch dev, and if I don’t kick off the server it starts a new one in the background