I am new to Clojure and not a pro in Javascript. I am watching the free part of the course on Reagent.
Following the instructions on the course's repo, after doing the git clone
and the npm install
, the author indicates running $ npm run dev
. Everything seems to work fine. I can see the app on my http://localhost:3000/
.
The favicon with the app's logo and its name is loaded on the corner of the browser's tab:
However, on the bottom of the web page, there is this error message from shadow-cljs
:
shadow-cljs - Stale Output! Your loaded JS was not produced by the running shadow-cljs instance. Is the watch for this build running?
Why is this happening? How should I fix it? How to guarantee that the watch for this building is running?
Is there a simple command to run on terminal to check this?
Obs. 1: If this is relevant, my operational system is NixOS and this is my config file.
Obs. 2: I am not sure if this question is connected to my previous question on npm
and Cider
(Emacs IDE for Clojure) that happened while working with this same repo.
It is likely that this is due to you running npm run dev
AND cider-jack-in
.
I don't use emacs, so I'm not exactly sure what cider-jack-in
does, but I believe it launches a new JVM. Since the npm run dev
also did that you end up with two running JVMs, which also means two running shadow-cljs
instances. That is not ideal and they will start interfering with each other leading to errors such as yours.
So, either you run npm run dev
and use emacs to connect to that server. cider-connect
or whatever is called should do that.
Or you don't run npm run dev
at all and instead only cider-jack-in
and then start the watch
from the REPL.
Don't forget to first kill all java processes that might be running for that project. As long as there is more than one shadow-cljs
process running for the project things will be weird.