[英]While developing Clojure, is running the dev environment with npm incompatible with Emacs Cider?
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 works fine.一切正常。 I can see the app on my
http://localhost:3000/
.我可以在我的
http://localhost:3000/
上看到该应用程序。
Since I am a heavy user of Emacs, I decided to start Cider , an emacs package that makes Emacs an IDE for Clojure.由于我是 Emacs 的重度用户,我决定启动Cider ,这是一个 emacs 包,它使 Emacs 成为 Clojure 的 IDE。 Thus, I would do interactive programming with REPL.
因此,我会使用 REPL 进行交互式编程。
After executing in Emacs cider-jack-in
, an error is returned.在 Emacs
cider-jack-in
执行后,返回错误。 Emacs indicates: Emacs 表示:
error in process sentinel: Could not start nREPL server: shadow-cljs - config: /home/pedro/projects/learn-reagent-course-files/giggin/shadow-cljs.edn shadow-cljs - connected to server server already running
进程前哨错误:无法启动 nREPL 服务器:shadow-cljs - 配置:/home/pedro/projects/learn-reagent-course-files/giggin/shadow-cljs.edn shadow-cljs - 连接到服务器服务器已经运行
While it is not possible to do cider-jack-in
after npm run dev
, it is possible to successfully use cider-jack-in
.虽然在
npm run dev
之后无法进行cider-jack-in
,但可以成功使用cider-jack-in
。 To do so, I just need to exit everything and without dealing with npm, simply execute cider-jack-in
on the repo.为此,我只需要退出所有内容,无需处理 npm,只需在 repo 上执行
cider-jack-in
即可。
Why is this happening?为什么会这样? Is Emacs cider incompatible with
npm run dev
? Emacs cider 与
npm run dev
不兼容吗? Incompatible with a server already running?与已经运行的服务器不兼容?
Concerning the error message content, what is the relation between Cider, the npm process, and shadow-cljs?关于错误信息的内容,Cider、npm 进程和 shadow-cljs 之间是什么关系?
I cannot comment on any Cider/Emacs specific things since I don't use it myself.我不能评论任何 Cider/Emacs 特定的东西,因为我自己不使用它。 I can however attempt to maybe clear up what is is doing:
但是,我可以尝试弄清楚正在做的事情:
npm run dev
just runs npx shadow-cljs watch app
(see package.json
"scripts"
). npm run dev
只是运行npx shadow-cljs watch app
(参见package.json
"scripts"
)。 It is just an alias, making it a little shorter.它只是一个别名,使它更短一些。 So, it starts shadow-cljs and begins the
app
build compilation and keeps watching for changes.因此,它启动 shadow-cljs 并开始
app
构建编译并持续关注变化。
cider-jack-in
on the other hand I believe also starts a fresh new JVM, which will be entirely independent and not aware or connected to the shadow-cljs processes started via npm run dev
.另一方面,我相信
cider-jack-in
也会启动一个全新的 JVM,它将完全独立,不知道或连接到通过npm run dev
启动的 shadow-cljs 进程。
It is possible to just use shadow-cljs
from the REPL you get from cider-jack-in
, but I don't know any specifics about what cider-jack-in
may already be doing for you.可以只使用从
cider-jack-in
获得的 REPL 中的shadow-cljs
,但我不知道cider-jack-in
可能已经为您做什么的任何细节。 Maybe the docs on REPL use can provide some help?也许关于 REPL 使用的文档可以提供一些帮助?
You can instead also just skip cider-jack-in
and instead have Cider connect to the shadow-cljs
instances started by npm run dev
.相反,您也可以跳过
cider-jack-in
,而是让 Cider 连接到由npm run dev
启动的shadow-cljs
实例。 I believe that command is cider-connect
.我相信该命令是
cider-connect
。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.