我安装了 Leiningen,但是当我运行 lein repl 时出现此错误:
java.io.IOException: Permission denied. Please check your access rights for /Users/ethanraymond/.lein/repl-port at leiningen.repl$repl.doInvoke (repl.clj:305)
clojure.lang.RestFn.invoke (RestFn.java:425)
leiningen.repl$repl.invoke (repl.clj:295)
clojure.lang.Var.invoke (Var.java:379)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invoke (core.clj:626)
leiningen.core.main$partial_task$fn__6094.doInvoke (main.clj:263)
clojure.lang.RestFn.invoke (RestFn.java:410)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.lang.AFunction$1.doInvoke (AFunction.java:29)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invoke (core.clj:626)
leiningen.core.main$apply_task.invoke (main.clj:313)
leiningen.core.main$resolve_and_apply.invoke (main.clj:319)
leiningen.core.main$_main$fn__6160.invoke (main.clj:392)
leiningen.core.main$_main.doInvoke (main.clj:385)
clojure.lang.RestFn.invoke (RestFn.java:408)
clojure.lang.Var.invoke (Var.java:379)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invoke (core.clj:624)
clojure.main$main_opt.invoke (main.clj:315)
clojure.main$main.doInvoke (main.clj:420)
clojure.lang.RestFn.invoke (RestFn.java:436)
clojure.lang.Var.invoke (Var.java:388)
clojure.lang.AFn.applyToHelper (AFn.java:160)
clojure.lang.Var.applyTo (Var.java:700)
clojure.main.main (main.java:37)
我找到的唯一答案是删除 Leiningen 并重新安装它,但这不起作用。
通过运行
~/.lein
确保目录 ls -ld .lein
归您所有,而不是由 root 拥有。如果不是,则运行 sudo chown -R <user> ~/.lein
。
对我来说,我必须创建一个新目录:
(base) ➜ ~ lein repl
java.io.IOException: Permission denied. Please check your access rights for /Users/jobevers/.lein/repl-port
at leiningen.repl$repl.invokeStatic (repl.clj:458)
leiningen.repl$repl.doInvoke (repl.clj:370)
clojure.lang.RestFn.invoke (RestFn.java:425)
leiningen.repl$repl.invokeStatic (repl.clj:435)
leiningen.repl$repl.invoke (repl.clj:370)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core$apply.invokeStatic (core.clj:669)
clojure.core$apply.invoke (core.clj:662)
leiningen.core.main$partial_task$fn__7430.doInvoke (main.clj:284)
clojure.lang.RestFn.invoke (RestFn.java:410)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.lang.AFunction$1.doInvoke (AFunction.java:31)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invokeStatic (core.clj:669)
clojure.core$apply.invoke (core.clj:662)
leiningen.core.main$apply_task.invokeStatic (main.clj:334)
leiningen.core.main$apply_task.invoke (main.clj:320)
leiningen.core.main$resolve_and_apply.invokeStatic (main.clj:343)
leiningen.core.main$resolve_and_apply.invoke (main.clj:336)
leiningen.core.main$_main$fn__7523.invoke (main.clj:469)
leiningen.core.main$_main.invokeStatic (main.clj:454)
leiningen.core.main$_main.doInvoke (main.clj:451)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.lang.Var.applyTo (Var.java:705)
clojure.core$apply.invokeStatic (core.clj:667)
clojure.main$main_opt.invokeStatic (main.clj:514)
clojure.main$main_opt.invoke (main.clj:510)
clojure.main$main.invokeStatic (main.clj:664)
clojure.main$main.doInvoke (main.clj:616)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.lang.Var.applyTo (Var.java:705)
clojure.main.main (main.java:40)
(base) ➜ ~ ls -l ~/.lein
ls: /Users/jobevers/.lein: No such file or directory
(base) ➜ ~ mkdir ~/.lein
(base) ➜ ~ lein repl
Retrieving nrepl/nrepl/1.0.0/nrepl-1.0.0.pom from clojars
Retrieving org/nrepl/incomplete/0.1.0/incomplete-0.1.0.pom from clojars
Retrieving nrepl/nrepl/1.0.0/nrepl-1.0.0.jar from clojars
Retrieving org/nrepl/incomplete/0.1.0/incomplete-0.1.0.jar from clojars
nREPL server started on port 55380 on host 127.0.0.1 - nrepl://127.0.0.1:55380
REPL-y 0.5.1, nREPL 1.0.0
Clojure 1.11.1
OpenJDK 64-Bit Server VM 21.0.2
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
user=>