为什么这个用 Clojure、ClojureSript、Figwheel、Lein 构建的 Web 应用程序在源代码版本之后没有在浏览器上更新?

Ped*_*ino 1 clojure leiningen clojurescript figwheel

我正在观看 Eric Normand 的前端课程/教程。\n课程是付费私人服务。

\n

但是,他正在使用 GitHub 上的公共存储库,this\none

\n

克隆并执行后lein fig-dev,该项目似乎已成功构建:

\n
2022-08-25 13:46:47.988:INFO::main: Logging initialized @3006ms to org.eclipse.jetty.util.log.StdErrLog\n[Figwheel] Validating figwheel-main.edn\n[Figwheel] figwheel-main.edn is valid \\(\xe3\x83\x84)/\n[Figwheel] Compiling build dev to "resources/public/js/compiled/app.js"\n[Figwheel] Successfully compiled build dev to "resources/public/js/compiled/app.js" in 1.33 seconds.\n[Figwheel] Watching paths: ("src") to compile build - dev\n[Figwheel:SEVERE] /private/var/folders/fh/7d_1drwd2ps3zw03j9ftkqs80000gn/T/jna1153974339277798676.tmp: dlopen(/private/var/folders/fh/7d_1drwd2ps3zw03j9ftkqs80000gn/T/jna1153974339277798676.tmp, 0x0001): tried: \'/private/var/folders/fh/7d_1drwd2ps3zw03j9ftkqs80000gn/T/jna1153974339277798676.tmp\' (fat file, but missing compatible architecture (have (unknown,i386,x86_64), need (arm64e)))\n[Figwheel] Starting Server at http://localhost:3449\n[Figwheel] Starting REPL\nPrompt will show when REPL connects to evaluation environment (i.e. a REPL hosting webpage)\nFigwheel Main Controls:\n          (figwheel.main/stop-builds id ...)  ;; stops Figwheel autobuilder for ids\n          (figwheel.main/start-builds id ...) ;; starts autobuilder focused on ids\n          (figwheel.main/reset)               ;; stops, cleans, reloads config, and starts autobuilder\n          (figwheel.main/build-once id ...)   ;; builds source one time\n          (figwheel.main/clean id ...)        ;; deletes compiled cljs target files\n          (figwheel.main/status)              ;; displays current state of system\nFigwheel REPL Controls:\n          (figwheel.repl/conns)               ;; displays the current connections\n          (figwheel.repl/focus session-name)  ;; choose which session name to focus on\nIn the cljs.user ns, controls can be called without ns ie. (conns) instead of (figwheel.repl/conns)\n    Docs: (doc function-name-here)\n    Exit: :cljs/quit\n Results: Stored in vars *1, *2, *3, *e holds last exception object\nOpening URL http://localhost:3449\nClojureScript 1.10.764\n\ncljs.user=> (js/alert "hello")\nnil\n\n
Run Code Online (Sandbox Code Playgroud)\n

这是我的全部日志(问题在下面的评论中提出)。

\n

浏览器启动(我使用的是 Brave)并且应用程序似乎已成功加载到http://localhost:3449// 上。

\n

我有一个 REPL 正在运行,我什至可以在本地主机的浏览器上以事件的形式发出类似的警报:

\n
cljs.user=> (js/alert "hello")\nnil\n
Run Code Online (Sandbox Code Playgroud)\n

好的。唯一的问题是当我像他在视频上那样编辑源代码时。在他的例子中,更改会在浏览器上生效。就我而言,\n他们没有。什么都没发生。

\n

只有从头开始重建一切,我才能看到变化。

\n

在其他项目中,我设法实时看到发生的变化,但我shadow-cljs在那里使用。

\n

我该如何解决?

\n

观察:我使用的是 Macbook M1,macOS Monterey 12.5.1

\n

Sea*_*eld 5

您所使用的版本中使用的 Hawk filewatcherfigwheel-main不支持 M1 Mac——这就是日志中与 JNA 相关的严重错误的内容。

的当前版本figwheel-main是 0.2.18,因此您可以尝试使用它来代替 中的 0.2.12 project.clj。根据更新日志,0.2.14 从 Hawk 切换到 Beholder,因此可能修复 M1 兼容性问题。

  • “缺少兼容架构”和“需要(arm64e)”是我的线索,临时文件路径中的“jna”表明这是一个 Java 本机访问问题。我自己不做任何 ClojureScript,但我看到一些人在 macOS 更新时也遇到了这个问题 (Hawk)。 (2认同)