我的硬盘早先崩溃了。看起来我的Clojure安装受到了影响。当我尝试lein repl
时,我会遇到以下错误。
$ lein repl
Exception in thread "Thread-5" java.net.ConnectException: Connection refused
at java.net.PlainSocketImpl.socketConnect(Native Method)
at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:382)
at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:241)
at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:228)
at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:431)
at java.net.Socket.connect(Socket.java:527)
at java.net.Socket.connect(Socket.java:476)
at java.net.Socket.<init>(Socket.java:373)
at java.net.Socket.<init>(Socket.java:187)
at clojure.tools.nrepl$connect.doInvoke(nrepl.clj:184)
at clojure.lang.RestFn.invoke(RestFn.java:421)
at clojure.tools.nrepl.ack$send_ack.invoke(ack.clj:47)
at clojure.tools.nrepl.server$start_server.doInvoke(server.clj:146)
at clojure.lang.RestFn.invoke(RestFn.java:619)
at user$eval597.invoke(NO_SOURCE_FILE:0)
at clojure.lang.Compiler.eval(Compiler.java:6703)
at clojure.lang.Compiler.eval(Compiler.java:6693)
at clojure.lang.Compiler.eval(Compiler.java:6666)
at clojure.core$eval.invoke(core.clj:2927)
at leiningen.core.eval$fn__4815.invoke(eval.clj:314)
at clojure.lang.MultiFn.invoke(MultiFn.java:231)
at leiningen.core.eval$eval_in_project.invoke(eval.clj:337)
at clojure.lang.AFn.applyToHelper(AFn.java:160)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:626)
at leiningen.repl$server$fn__8776.invoke(repl.clj:203)
at clojure.lang.AFn.applyToHelper(AFn.java:152)
at clojure.lang.AFn.applyTo(AFn.java:144)
at clojure.core$apply.invoke(core.clj:624)
at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1862)
at clojure.lang.RestFn.invoke(RestFn.java:425)
at clojure.lang.AFn.applyToHelper(AFn.java:156)
at clojure.lang.RestFn.applyTo(RestFn.java:132)
at clojure.core$apply.invoke(core.clj:628)
at clojure.core$bound_fn_STAR_$fn__4140.doInvoke(core.clj:1884)
at clojure.lang.RestFn.invoke(RestFn.java:397)
at clojure.lang.AFn.run(AFn.java:22)
at java.lang.Thread.run(Thread.java:695)
REPL server launch timed out.
我的leiningen安装是通过自制程序安装的,所以我尝试卸载然后重新安装。
$ brew rm --force leiningen
Uninstalling leiningen...
$ brew install leiningen
==> Downloading https://github.com/technomancy/leiningen/archive/2.4.2.tar.gz
Already downloaded: /Library/Caches/Homebrew/leiningen-2.4.2.tar.gz
==> Downloading https://github.com/technomancy/leiningen/releases/download/2.4.2/leining
Already downloaded: /Library/Caches/Homebrew/leiningen--jar-2.4.2.jar
==> Caveats
Dependencies will be installed to:
$HOME/.m2/repository
To play around with Clojure run `lein repl` or `lein help`.
Bash completion has been installed to:
/usr/local/etc/bash_completion.d
zsh completion has been installed to:
/usr/local/share/zsh/site-functions
==> Summary
/usr/local/Cellar/leiningen/2.4.2: 8 files, 13M, built in 2 seconds
没有骰子。我仍然得到同样的错误。什么破坏了,我该如何解决?
编辑:
其他诊断信息:
$ lein repl :headless
nREPL server started on port 56785 on host 127.0.0.1 - nrepl://127.0.0.1:56785
$ lein repl :connect localhost:56785
Connecting to nREPL at localhost:56785
ConnectException Connection refused
java.net.PlainSocketImpl.socketConnect (PlainSocketImpl.java:-2)
java.net.PlainSocketImpl.doConnect (PlainSocketImpl.java:382)
java.net.PlainSocketImpl.connectToAddress (PlainSocketImpl.java:241)
java.net.PlainSocketImpl.connect (PlainSocketImpl.java:228)
java.net.SocksSocketImpl.connect (SocksSocketImpl.java:431)
java.net.Socket.connect (Socket.java:527)
java.net.Socket.connect (Socket.java:476)
java.net.Socket.<init> (Socket.java:373)
java.net.Socket.<init> (Socket.java:187)
clojure.tools.nrepl/connect (nrepl.clj:184)
clojure.core/apply (core.clj:624)
clojure.tools.nrepl/add-socket-connect-method!/fn--5686 (nrepl.clj:226)
Bye for now!
$ ping localhost
PING localhost (127.0.0.1): 56 data bytes
64 bytes from 127.0.0.1: icmp_seq=0 ttl=64 time=0.059 ms
64 bytes from 127.0.0.1: icmp_seq=1 ttl=64 time=0.133 ms
64 bytes from 127.0.0.1: icmp_seq=2 ttl=64 time=0.141 ms
64 bytes from 127.0.0.1: icmp_seq=3 ttl=64 time=0.149 ms
64 bytes from 127.0.0.1: icmp_seq=4 ttl=64 time=0.119 ms
64 bytes from 127.0.0.1: icmp_seq=5 ttl=64 time=0.078 ms
^C
--- localhost ping statistics ---
6 packets transmitted, 6 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.059/0.113/0.149/0.033 ms
$ lein repl :connect 127.0.0.1:56785
Connecting to nREPL at 127.0.0.1:56785
REPL-y 0.3.1
Clojure 1.6.0
Docs: (doc function-name-here)
(find-doc "part-of-name-here")
Source: (source function-name-here)
Javadoc: (javadoc java-object-or-class-here)
Exit: Control+D or (exit) or (quit)
Results: Stored in vars *1, *2, *3, an exception in *e