[英]Why is shadow-cljs returning this error message on "Stale Output"? How to guarantee the watch for this building is running?
I am new to Clojure and not a pro in Javascript.我是 Clojure 的新手,而不是 Javascript 的专家。 I am watching the free part of the course on Reagent .
我正在观看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
.按照课程repo上的说明,在执行
git clone
和npm install
之后,作者指示运行$ npm run dev
。 Everything seems to work fine.一切似乎都很好。 I can see the app on my
http://localhost:3000/
.我可以在我的
http://localhost:3000/
上看到该应用程序。
The favicon with the app's logo and its name is loaded on the corner of the browser's tab:带有应用程序徽标及其名称的 favicon 加载在浏览器选项卡的角落:
However, on the bottom of the web page, there is this error message from shadow-cljs
:但是,在网页底部,有来自
shadow-cljs
错误消息:
shadow-cljs - Stale Output!
shadow-cljs - 过时的输出! Your loaded JS was not produced by the running shadow-cljs instance.
您加载的 JS 不是由正在运行的 shadow-cljs 实例生成的。 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 .
1 :如果这是相关的,我的操作系统是 NixOS,这是我的配置文件。
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. 2 :我不确定这个问题是否与我之前在使用同一个 repo 时发生的关于
npm
和Cider
(Emacs IDE for Clojure) 的问题相关联。
This happens to me when I clicked on the build link BEFORE it has compiled.当我在编译之前单击构建链接时,就会发生这种情况。 In which case, the link is displaying a previously compiled version, not the live version, and "watch" on code changes doesn't work either.
在这种情况下,链接显示的是以前编译的版本,而不是实时版本,并且“监视”代码更改也不起作用。 Just wait for your terminal output to say "compiled" before clicking on the link.
只需等待您的终端输出显示“已编译”,然后再单击链接。
It is likely that this is due to you running npm run dev
AND cider-jack-in
.这很可能是由于您运行了
npm run dev
和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.我不使用 emacs,所以我不确定
cider-jack-in
是做什么的,但我相信它会启动一个新的 JVM。 Since the npm run dev
also did that you end up with two running JVMs, which also means two running shadow-cljs
instances.由于
npm run dev
也这样做了,因此您最终会得到两个正在运行的 JVM,这也意味着两个正在运行的shadow-cljs
实例。 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.因此,您可以运行
npm run dev
并使用 emacs 连接到该服务器。 cider-connect
or whatever is called should do that. cider-connect
或任何被调用的东西都应该这样做。
Or you don't run npm run dev
at all and instead only cider-jack-in
and then start the watch
from the REPL.或者你根本不运行
npm run dev
而是只运行cider-jack-in
然后从 REPL 启动watch
。
Don't forget to first kill all java processes that might be running for that project.不要忘记首先杀死可能为该项目运行的所有 java 进程。 As long as there is more than one
shadow-cljs
process running for the project things will be weird.只要项目中运行的
shadow-cljs
进程不止一个,事情就会变得很奇怪。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.