Fork me on GitHub
Heikki Hämäläinen10:10:40

Is there any way to get compilation warnings and node output to same terminal output? My current setup is to run in one terminal “shadow-cljs watch <target>” then in another “node <target>.js” and after that connect Cursive REPL to nrepl. This leads to situation where REPL output is in one window, node output (like logging) in one and compilation in one. Is there some way to redirect outputs to combined view somehow?


@heikki.hamalainen currently that is not possible no. it sort of works if you run node-repl (without a build) via the Cursive nREPL


so you run shadow-cljs server


connect with cursive as usual and run (shadow/node-repl)


but that is only a REPL, it doesn't watch

Heikki Hämäläinen10:10:29

Ok, watch is still needed so I will still continue to run multiple terminals. Thanks for the reply. I needed to check this out because I was thinking that perhaps I have misunderstood something.


the issue is that I don't want to "hijack" the default node streams


since you run node target.js separately I'd have to mess with process.stdout and process.stderr


which I'm not really comfortable with 😛


but the Inspect work I previewed yesterday is meant to address this in a different way anyways 😛


so you wouldn't use prn or console.log for debugging output but tap> instead


still doesn't end up in Cursive though 😉

Heikki Hämäläinen10:10:30

Yes, that looks promising. Should be easy to add tap> to timbre logging as a middleware.


maybe. I don't use timbre so not really sure what it does.

Heikki Hämäläinen11:10:15

timbre is a logging library which is quite used in Clojure community:


yes I know what it is. but I don't know what it does internally to do what it does


like what happens if you attempt to log a really large value?


Using :module-hash-names changes actual file names. I'm thinking how to handle the same issue with my CSS files. Another approach would be to add a dummy query parameter so I don't have to rename anything or create some convoluted logic on my web server. But changing actual file names is more robust and explicit as it's a 1-to-1 match (for practical reasons only, because MD5) to the actual code. Do you have any thoughts on how it should be handled with CSS? Do you any example source code that deals with this issue?


I do but its part of my work code and hasn't been touched in 5 years or so


not something I would want to share 😛


I prefer changing the filename over the query parameter but query should be fine. many sites do that.


Yeah, understandably so, because it should be easy to implement. But it still leaves a possibility for nasty errors where "it works on my machine". OK, thanks anyway. I'll try to think of something not too outlandish. After all, It's already a mixed codebase where UI is in CLJS and the server is in Python. 🙂


I used a ruby script since back then my backend was still ruby


it just takes a bunch of css files. minifies them and renames with the hash. then writes a manifest.json which the server reads so it knows about the names

Filipe Silva14:10:21

@thheller I'm seeing some odd behaviour for :node-test targets on windows only

Filipe Silva14:10:00

the target looks like this:

      {:autorun true,
       :ns-regexp "e2e.*",
       :output-to "out/e2e.js",
       :target :node-test},

Filipe Silva14:10:14

on linux and macos it runs swell

Filipe Silva14:10:23

but on windows it runs twice

Filipe Silva14:10:53

and since this particular test interacts with the FS, one test interferes with the other

Filipe Silva15:10:35

I think it exits with the exit code of the first run, because the second one fails but the run does not fail

Filipe Silva15:10:51

I say it runs twice because the output looks like this:

Filipe Silva15:10:59

Run yarn e2e
yarn run v1.19.1
$ shadow-cljs compile e2e
shadow-cljs - config: D:\a\create-cljs-app\create-cljs-app\shadow-cljs.edn  cli version: 2.8.67  node: v12.13.0
shadow-cljs - connected to server

[:e2e] Compiling ...
========= Running Tests =======================

Testing e2e.core
shadow-cljs - socket connect failed, server process dead?
[:e2e] Compiling ...
========= Running Tests =======================

Testing e2e.core
rm: could not remove file (code EBUSY): test-app/node_modules/clj-kondo/unpacked_bin/clj-kondo.jar
rm: could not remove directory (code ENOTEMPTY): test-app/node_modules/clj-kondo/unpacked_bin
rm: could not remove directory (code ENOTEMPTY): test-app/node_modules/clj-kondo
rm: could not remove directory (code ENOTEMPTY): test-app/node_modules
rm: could not remove directory (code ENOTEMPTY): test-app

Filipe Silva15:10:57

I think I saw this happening only after I began using a background server via shadow-cljs start


I thought the docs mention this.


do not use :autorun


I wish I never added it to begin with


the output does indeed look weird but I'm not willing to look into anything that uses :autorun


run shadow-cljs compile e2e && node out/e2e.js or so


separate compilation from the actual running of the tests

Filipe Silva15:10:47

was the user guide the wrong place to look for this information? I usually use it as my main resource but it does say it is a WIP


(boolean, optional) Run the tests via node when a build completes. This is mostly meant to be used in combination with watch. The node process exit code will not be returned as that would have to forcefully kill the running JVM.


The node process exit code will be set to 0 when successful and 1 on any failures. (The node process exit code will not be returned when using :autorun.)

Filipe Silva15:10:28

ok I see now, I should not rely on the exit code


you SHOULD rely on the exit code


just not with :autorun


just don't use it ... ever ...

Filipe Silva15:10:26

yes I meant with autorun 😄


once compile finishes you can even shutdown shadow-cljs before running the tests. it won't be required for the actual tests


this github CI thing looks nice. how do you like it so far?

Filipe Silva15:10:10

I like it a lot, but there are some nuances

Filipe Silva15:10:01

I like it because it's one of the only CIs that offers free Windows runs, which I believe are required for OSS to treat windows users as first class citizens

Filipe Silva15:10:26

the other one is azure pipelines, and tbh gh-actions is really just pipelines in the background

Filipe Silva15:10:49

it is not as fully featured as stuff like circleci

Filipe Silva15:10:30

it doesn't have cache right now, but I'm into their private feedback org and was told it it's one of the things they are working on right now

Filipe Silva15:10:38

integrations are top notch though


it also doesn't have ssh access like circleci


which has been essential for me when debugging a build


guess I'll stick with circleci for now. works ok after all.


but it seems to be faster than circleci for e.g. graalvm builds (minus the caching issue)

Filipe Silva15:10:40

yeah ssh is missing too, but circleci is the only one with it so it's not really a common feature. although it's a super useful one, also saved me a bunch of times.

Filipe Silva15:10:09

I asked them about ssh once and they said it was on their radar, but no news so far


does gh actions also do Windows builds?

Filipe Silva15:10:16

I do ubuntu/osx/windows on it


I love that artifacts are downloadable on gh-actions, contrary to circleci


by anyone I mean

Filipe Silva15:10:38

I'm conflicted about that

Filipe Silva15:10:52

circleci has a way to make downloadable artifacts

Filipe Silva15:10:15

I used artifacts on that run as workspace files are used in circle

Filipe Silva15:10:33

which isn't great, I don't want people to download that single js file

Filipe Silva15:10:41

I just don't want to double build when not necessary


I have pasted a link to an artifact in circleci many times for people to preview something


instead I could just say "go look at the build for this commit and download the artifact"

Filipe Silva15:10:07

I'm a bit confused, I expect that to work

Filipe Silva15:10:55

@thheller what is the intended workflow for :node-test targets via watch, but without autorun? Is it to have some node watcher waiting to rerun the out file?


depends on what you want. I typically don't want tests to run whenever I safe a file


I mostly run tests in the REPL


eg. you could create a keyboard shortcut REPL command that runs the tests on keypress via the REPL

Filipe Silva15:10:20

hm... trying to emulate the overall watch functionality for things like karma setups

Filipe Silva15:10:35

(although this isn't using karma and I don't want karma atm)

Filipe Silva15:10:21

for the target audience, I would prefer a single process that runs in the background

Filipe Silva15:10:36

yeah that or nodemon sounds like the best approach


chokidar out/e2e.js -c "not out/e2e.js"


you can use :autorun if you really need to, I just don't recommend it


maybe I should add something like :autorun-in-watch-only true or so

👍 4

so it doesn't attempt to :autorun with compile

Filipe Silva15:10:30

is it possible to override :autorun for the same target? e.g. shadow-cljs watch test --autorun or something


shadow-cljs watch test --config-merge "{:autorun true}"

Filipe Silva15:10:29

if autorun isn't recommended for compile I think it makes a lot of sense to disable it it, or provide an alternate explicit flag

Filipe Silva15:10:44

thank you for explaining this to me

Filipe Silva15:10:56

I'll add these as defaults to my starter project:

"test": "shadow-cljs watch test --config-merge \"{:autorun true}\"",
    "test:once": "shadow-cljs compile test && node out/test.js",
    "e2e": "shadow-cljs compile e2e && node out/e2e.js",


maybe use "test" and "test:watch"?

Filipe Silva15:10:10

I actually agree with that but it turns out it's surprising for a lot of the target audience


at least my expectation is for test to do a test once

Filipe Silva15:10:39

in Angular CLI we flipped the meaning once and there was a lot of pushback

Filipe Silva15:10:41

certain communities have surprising expectations for defaults


easy to get used to something like that I guess

Filipe Silva15:10:26

you know how e2e tests are by definition slow things that test a lot of stuff? a longstanding issue we've had is to have e2e watch mode

Filipe Silva15:10:34

which I cannot fathom anyone could truly want

Filipe Silva15:10:45

here we're event talking about e2e using protractor, which is slow and defaults to running in a visual mode


yeah for me thats a problem with :autorun already


not uncommon for a test for take a couple seconds


especially build related stuff ... if that blocked the normal watch I'd be pretty annoyed

Filipe Silva15:10:00

yeah same here


I’m getting a couple of infer warnings for a library that I’m using httpurr: — is this something that should be addressed at the library level or an issue with Shadow CLJS?


neither I guess


they can be renamed since they are from the closure library


you could add typehints to make the warnings go away but they aren't required


right, but that’s kind of annoying, no? having to modify third party code to hide warnings that are false negatives…


you shouldn't be getting warnings for third party code (in .jar files)


I guess the problem is .gitlibs


you can open an issue about those. since they are actually files they are treated as-if they are your project files


so you get warnings, but probably shouldn't


Ah ok! That makes a lot of sense I’ll open an issue :)


Hey all! Has anyone gotten refactor-nrepl working in a tools.deps project? I'm getting an error on cider startup that says:

WARNING: clj-refactor and refactor-nrepl are out of sync.
Their versions are 2.5.0-SNAPSHOT and n/a, respectively.
Looking at the jack in command:
[nREPL] Starting server via /usr/bin/npx shadow-cljs -d nrepl:0.6.0 -d cider/piggieback:0.4.2 -d refactor-nrepl:2.5.0-SNAPSHOT -d cider/cider-nrepl:0.22.4 server
And I've even got them explicitly listed as dependencies:
refactor-nrepl              {:mvn/version "2.5.0-SNAPSHOT"}
    cider/cider-nrepl           {:mvn/version "0.22.4"}


Any tips on where to go from here?


do I need to do something to get babel to work with shadow-cljs? I'm trying to require a jsm module from three.js, but shadow-cljs is erroring with:

    throw err;

Error: Cannot find module 'babel-core'
Require stack:
- /project/.shadow-cljs/babel-worker/babel-worker.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:772:15)
    at Function.Module._load (internal/modules/cjs/loader.js:677:27)
    at Module.require (internal/modules/cjs/loader.js:830:19)
    at require (internal/modules/cjs/helpers.js:68:18)
  requireStack: [


please don't cut stacktraces 😛


did you try adding custom plugins/presets?


I'm not using babel myself in this project.


hmm not sure what that is about


how do you require it?


["three/examples/jsm/loaders/GLTFLoader" :refer [GLTFLoader]]


where do you get this error?


on my project build shadow-cljs watch main


when or where?


some log context helps a lot


hmm thats a weird one


The weird land of JS modules and transpilation..


it is the babel package contained in shadow-cljs


but I don't get why it would try to require("babel-core")


certainly not at

at /Users/baruchberger/work/nursico/.shadow-cljs/babel-worker/babel-worker.js:399:229
    at Object.<anonymous> (/Users/baruchberger/work/nursico/.shadow-cljs/babel-worker/babel-worker.js:404:3)


can you delete that file and restart shadow-cljs?


maybe you have some old version for some reason?


I tried deleting .shadow-cljs a couple times before


hmm then this should be reproducible


please open an issue. doing other stuff currently that I want to finish first


alright, let me set-up a reproduce case tomorrow


will do, thanks!


might an old question, today I bumped my shadow and I get:

shadow-cljs - starting via "clojure"
Exception in thread "main" Could not locate shadow/cljs/devtools/cli__init.class, shadow/cljs/devtools/cli.clj or shadow/cljs/devtools/cli.cljc on classpath.
	at clojure.lang.RT.load(
	at clojure.lang.RT.load(


missing thheller/shadow-cljs dep in deps.edn


it is no longer auto injected


oh this was through cider master, does it mean that has to change too?


(well should cider auto-inject is not maybe a q for you I know :D)


not sure what you mean


cider still injects itself so that should still work


shadow-cljs just doesn't because that was causing more annoying issues than actually helping


@richiardiandrea if you add shadow-cljs as a dep it will fix it


This is the issue I’m running into (it’s less pleasant with a lot going on). I’m hoping it’s something well known that folks have run into, since IDEA project debugging can run on for a very long time.


@tekacs Cursive doesn't support js/


😂 thank you :)


I have relatively little use for it, so I guess I’ll just keep them to few places and not worry about it :)


I am looking to run shadow-cljs behind a reverse proxy (to develop w/ https locally). Is it possible to allow shadow to have the app connect to shadow's websocket on a proxy port (say 9640) but still listen for the WS on 9630?


I see the SSL config guidance in the documentation, but hoping to be able to just configure SSL once on my proxy


@davewo see :devtools-url in the docs

thanks 4

Is there a good template / general wisdom for keeping a frontend CLJS along-side a CLJ backend app in the same repo?


I kind of want to have a hard separation where shadow-cljs is used in frontend/ and lein in backend/


But I’ve also seen something like src/main/clj and src/main/cljs


i recommend using your namespaces to separate stuff. I usually have src/main/my/company/frontend/app.cljs or so with a src/main/my/company/server.clj


:source-paths works but IMHO gets annoying as soon as you have code that you want to use on both platforms


And I just might


this week i tried this one lein new reagent <project name> +shadow-cljs from lein. and it worked pretty well. it run a backend and also compile cljs to javascript with shadow-cljs. Now i include Karma to the project and suprisely it run fine!

David Reno18:10:23

I’m struggling a bit with Spacemacs/Cider and shadow-cljs. I see but it’s not helping. Is there any kind of procedure to follow to ensure that each step is complete? I’m thinking of something like this: 1. run java -v and verify version > 8 2. run node -v and verify version > 6 3. do <this thing> to make sure your paths are set correctly 4. run npx shadow-cljs init 5. edit shadow-cljs.edn and set :source-paths to values <something> 6. verify configuration by doing <this smart thing> 7. start emacs, open shadow-cljs.edn 8. start the n-repl and connect from cider by running M-x cider-jack-in-cljs 9. everything else… Looking for something that’s going to stop me before I go to far without having the basics correct.


@dcreno ignore cider until everything works on the command line. Then it should hopefully run in CIDER just fine

David Reno19:10:03

I think it does but I’ll run through it one more time.

David Reno19:10:52

npx create-cljs-project t2 works fine and creates a skeleton directory. npx shadow-cljs node-repl starts and produces a working (seeming) REPL and a web-page available on .


perfect. now do cider-jack-in-cljs and it should work. and node your-script.js or whatever to have the runtime

David Reno19:10:54

From *Messages*

[nREPL] Starting server via /usr/local/bin/npx shadow-cljs -d nrepl:0.6.0 -d cider/piggieback:0.4.0 -d cider/cider-nrepl:0.22.0-SNAPSHOT server...
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: env: node: No such file or directory

David Reno19:10:25


error in process sentinel: Could not start nREPL server: env: node: No such file or directory


that's emacs saying it has no idea what node is


same as if node wasn't on your path for your terminal

David Reno19:10:42

I vaguely remember installing node and seeing that it wanted me to set PATH a certain way, sure I didn’t. May need to uninstall/reinstall and read better.


that might not be necessary

David Reno19:10:09

➜  ~ which node

David Reno19:10:20

➜  ~ node --version


look at exec-path that's emac's path. you need to add node to the emacs path in the same way you do it for shells

David Reno19:10:03

(getenv PATH) doesn’t show /Users/dreno200/n/bin, working on finding right zsh file to add it to…


you can call directly (add-to-list 'exec-path "/Users/dreno200/n/bin")

David Reno19:10:00

yeah, used setenv to put it in the path and got this now:

[yas] Prepared just-in-time loading of snippets successfully.
Loading /Users/dreno200/.emacs.d/.cache/company-statistics-cache.el (source)...done
[nREPL] Starting server via /usr/local/bin/npx shadow-cljs -d nrepl:0.6.0 -d cider/piggieback:0.4.0 -d cider/cider-nrepl:0.22.0-SNAPSHOT server...
error in process sentinel: nrepl-server-sentinel: Could not start nREPL server: shadow-cljs - config: /Users/dreno200/Documents/dev/t2/shadow-cljs.edn  cli version: 2.8.67  node: v10.17.0
shadow-cljs - connected to server
server already running

 [2 times]
error in process sentinel: Could not start nREPL server: shadow-cljs - config: /Users/dreno200/Documents/dev/t2/shadow-cljs.edn  cli version: 2.8.67  node: v10.17.0
shadow-cljs - connected to server
server already running
Will need to play with it a bit.


> server already running


its already started and they are fighting over the port

David Reno19:10:28

Maybe I should have stopped the CLI first.

David Reno20:10:05

shutdown npx shadow-cljs node-repl from CLI, now getting this in *Messages*:

error in process sentinel: Could not start nREPL server: shadow-cljs - config: /Users/dreno200/Documents/dev/t2/shadow-cljs.edn  cli version: 2.8.67  node: v10.17.0
===== ERROR =================
Executable 'java' not found on system path.
However, I java is in /usr/bin:
➜  t2 which java
➜  t2 java -version
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
➜  t2
and I have it set in emacs as the first item in the PATH environment variable with (setenv). Seems to clearly be a path problem though.


there's a package which might be helpful for you

David Reno20:10:26

yeah, that just seems so much easier, but then again, I only use emacs for Clojure and Scheme.

David Reno21:10:37

progress: spacemacs PATH is set by PATH environment variable in .spacemacs.env. Even though it’s documented to append multiple PATH statements, it seems it was somehow confused. By reducing the statements to one and shortening, I got the right path in there (i.e. one with node and java). Now when running cider-jack-in-cljs it seems to work by prompting for a REPL type (I chose node), and starting a browser window pointing to . *Messages*:

[nREPL] Starting server via /usr/local/bin/npx shadow-cljs -d nrepl:0.6.0 -d cider/piggieback:0.4.0 -d cider/cider-nrepl:0.22.0-SNAPSHOT server...
[nREPL] server started on 50825
[nREPL] Establishing direct connection to localhost:50825 ...
[nREPL] Direct connection to localhost:50825 established
Visit '' in a browser? (y or n) y
helm: Error: Trying to run helm within a running helm session
Quit [3 times]
I’ll try to find a shadow-cljs troubleshooting doc and a place where I can add advice about verifying that node and java are in the path as reported by (getenv PATH). Thanks for your help!


are both your front end and backend run through shadow?

David Reno21:10:41

I don’t even know what that means.

David Reno21:10:00

I’m trying to use shadow for everything because it seems well thought out.


ok. so both front end and back end are shadow-cljs


don't choose node then. choose shadow-cljs and then choose the build

David Reno21:10:41

ok, I’ll start it again.

David Reno21:10:44

shadow choices are shadow or shadow-select.


choose shadow


and there's gonna be two different choices. the first is what repl you want. there you are gonna choose shadow-cljs. the next will be which shadow build do you want. and you want to choose whatever you named your backend build


in your shadow-cljs.edn file

David Reno21:10:55

ah, and then it prompts for build and suggests dev which I suppose corresponds to whatever is in the shadow-cljs.edn file.

David Reno21:10:49

are there docs about this because I am not seeing anything like this anywhere. Certainly appreciate your help but don’t want to be a drag.


the first choice is from CIDER. you need to say which repl you are using. if its figwheel, figwheel-main, shadow-cljs. unfortunately cljs tooling is a bit all over the map. but you're doing shadow-cljs and its a great product and that's what you say there all the time


the second choice is from shadow but CIDER is asking for you. from the docs of shadow, when you run npx shadow-cljs watch [build] this choice is asking you which shadow build you want to run

David Reno21:10:58

seem to have it working now, can eval within spacemacs and see the little green bars on the left of the s-exps as I eval them.




welcome to the cljs community

David Reno21:10:25

thanks again for sticking with me.


when you have shadow questions ask in #shadow-cljs and any CIDER related questions, from absolute beginner to how to modify and submit a patch come to #cider

👍 8

Is there a way to change the import statements in a JS dependency? I want to use react-native-base (UI kit) in both a web page and mobile app, by swapping our "react-native" with "react-native-web" Here’s how the react native base docs suggest doing it with webpack