When I start my shadow-cljs repl with CIDER and go to localhost:8080 as it says, the html page displayed is from a completely different project from a different git repo. I have tried everything, even rebooting, but it still insists on using the wrong code. Also, there's a message at the bottom of the screen about Stale Output.
change the port in shadow-cljs.edn (assuming you are using :dev-http) and try localhost:8080 and the new one
dunno what your setup is like, so can't suggest much else
wow, that fixed it!
no wait, it shows the correct code but still has a banner about stale output
I assume the watch is actually running?
well when I type anything in the repl is sais "No available JS runtime".
yes, stale code means the connection didn't work. this usually means that the JS you have loaded in the browser was not created by the shadow-cljs instance currently running
which in the past could be caused by running shadow-cljs twice in the same project, but I added a check for that. if you are on an older version this check might not exist
hm I'm on 2.28.21
that definitely has that check, but I'm assuming you are not starting it twice anyway 😛
not unless CIDER is
I do not know enough about your setup to really comment further. just guessing here.
all the parts involved are shadow-cljs creating .js files on disk, a http server serving a folder over http and a secondary http server by shadow-cljs the generated JS wants to talk to over websocket. not much involved, so not many things to check really.
but you could have created some kind of abomination setup that doesn't use any of these things and makes everything custom. I wouldn't know 😛
I did the tictactoe tutorial and then started to add reitit to it for routing: https://replicant.fun/tutorials/tic-tac-toe/ At some point it worked but apparently something happened a few hours ago. I did have another repl running for plain Java clojure on another project. But that was definitely not shadow-cljs.
so what is your current config? shadow-cljs.edn I mean
{:deps {}
:dev-http {8085 ["resources/public" "classpath:public"]}
:builds
{:app
{:target :browser
:modules {:main {:init-fn tic-tac-toe.core/main}}
:dev {:output-dir "resources/public/app-js"}}
:portfolio
{:target :browser
:modules {:main {:init-fn tic-tac-toe.scenes/main}}
:dev {:output-dir "resources/public/portfolio-js"}}}}what is the output you get when you run npx shadow-cljs watch app portfolio in the terminal. so no cider involved?
if I run this on command-line it appears to work correctly:
npx shadow-cljs watch app portfolio
In this case it has watches for both app and portfolio.
But this morning it worked with just watching portfolio.well if you only watch the portfolio build but load the app output in the browser that will give you a stale warning, because that watch isn't running?
OK that makes sense. I still have some errors on my other project but that is probably something else.
the only reason I started up a repl in this project was to find out if shadow-cljs was the common problem. I now know it isn't
so thanks
CIDER doesn't appear to allow me to watch multiple builds so I have no idea how this worked yesturday.
maybe I did have two servers running
you can always start another build from the CLJ REPL or the web interface http://localhost:9630
I don't know exactly how the integration in cider works these days, but I'm assuming they just issue a watch command over the REPL in the same way you could manually
(shadow/watch :app) if you are in the shadow.user ns, otherwise (shadow.cljs.devtools.api/watch :app)
yep I never did it manually it just worked in the past. I guess that's why it's all such a mystery when it broke.
also I've never seen that web interface 😮
try (tap> some-data-structure) anywhere and look at it in Inspect 😉
This morning I am just getting No available JS runtime.
I didn't change anything except reboot and start it back up.
oh I fixed it. refresh the page in firefox after a few seconds
yes, JS runtime here is refering to the browser. so the app needs to be open in the browser and the browser needs to connect back to shadow-cljs, which should happen automatically when the watch is running