我是一名 Clojure 新手,正在尝试学习 clj 工具。我正在遵循这个https://betweentwoparens.com/start-a-clojurescript-app-from-scratch教程,并在命令 clj -A:dev
得到以下错误
Downloading: com/google/protobuf/protobuf-java/3.0.2/protobuf-java-3.0.2.jar from central
Downloading: com/google/code/findbugs/jsr305/3.0.2/jsr305-3.0.2.jar from central
Downloading: com/google/code/gson/gson/2.7/gson-2.7.jar from central
Exception in thread "Thread-4" java.net.SocketException: Broken pipe (Write failed)
at java.base/java.net.SocketOutputStream.socketWrite0(Native Method)
at java.base/java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:110)
at java.base/java.net.SocketOutputStream.write(SocketOutputStream.java:150)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at clojure.lang.Reflector.invokeMatchingMethod(Reflector.java:167)
at clojure.lang.Reflector.invokeInstanceMethod(Reflector.java:102)
at cljs.repl.server$send_and_close.invokeStatic(server.clj:168)
at cljs.repl.server$send_and_close.invoke(server.clj:144)
at cljs.repl.browser$send_static.invokeStatic(browser.clj:205)
at cljs.repl.browser$send_static.invoke(browser.clj:178)
at cljs.repl.server$dispatch_request.invokeStatic(server.clj:191)
at cljs.repl.server$dispatch_request.invoke(server.clj:182)
at cljs.repl.server$handle_connection.invokeStatic(server.clj:199)
at cljs.repl.server$handle_connection.invoke(server.clj:195)
at cljs.repl.server$server_loop$fn__68.invoke(server.clj:209)
at clojure.core$binding_conveyor_fn$fn__5754.invoke(core.clj:2030)
at clojure.lang.AFn.run(AFn.java:22)
at java.base/java.lang.Thread.run(Thread.java:834)
我为什么得到这个错误?我的环境
Mac OS X Mojave 上 VirtualBox 的 Ubuntu 18.04 无头虚拟机。
[I] /home/user/tallex~> java -version
openjdk version "11.0.6" 2020-01-14 LTS
OpenJDK Runtime Environment Corretto-11.0.6.10.1 (build 11.0.6+10-LTS)
OpenJDK 64-Bit Server VM Corretto-11.0.6.10.1 (build 11.0.6+10-LTS, mixed mode)
我也试过这样操作
[I] /home/sporty/software~> java -version
openjdk version "11.0.6" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1)
OpenJDK 64-Bit Server VM (build 11.0.6+10-post-Ubuntu-1ubuntu118.04.1, mixed mode, sharing)
结果是一样的。
编辑:这个问题与在无头虚拟机上运行 CLJ 无法打开浏览器有关。所以我为主机添加了端口转发,似乎可以启动 X 窗口浏览器。