本文介绍了无法运行lein脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了lein,并将其放在我的/bin文件夹中,并使其可执行.我还下载了Java:

I've downloaded lein, put it in my /bin folder, and made it executable. I've also downloaded java:

$java -version
java version "1.7.0_65"

但是运行命令时出现以下错误:

But I get the following error upon running the command:

$lein
java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry
 at clojure.lang.APersistentMap$ValSeq.first (APersistentMap.java:185)
    clojure.lang.RT.first (RT.java:577)
    clojure.core$first.invoke (core.clj:55)
    clojure.core$map$fn__4245.invoke (core.clj:2559)
    clojure.lang.LazySeq.sval (LazySeq.java:40)
    clojure.lang.LazySeq.seq (LazySeq.java:49)
    clojure.lang.RT.seq (RT.java:484)
    clojure.core$seq.invoke (core.clj:133)
    clojure.core$zipmap.invoke (core.clj:2788)
    leiningen.core.utils$map_vals.doInvoke (utils.clj:115)
    clojure.lang.RestFn.invoke (RestFn.java:442)
    leiningen.core.user/fn (user.clj:69)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invoke (core.clj:624)
    clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    leiningen.core.user/fn (user.clj:85)
    clojure.lang.AFn.applyToHelper (AFn.java:152)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invoke (core.clj:624)
    clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
    clojure.lang.RestFn.invoke (RestFn.java:397)
    leiningen.core.project$read_profiles.invoke (project.clj:622)
    leiningen.core.project$project_with_profiles.invoke (project.clj:736)
    leiningen.core.main$_main$fn__5979.invoke (main.clj:358)
    leiningen.core.main$_main.doInvoke (main.clj:353)
    clojure.lang.RestFn.invoke (RestFn.java:397)
    clojure.lang.Var.invoke (Var.java:375)
    clojure.lang.AFn.applyToHelper (AFn.java:152)
    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:421)
    clojure.lang.Var.invoke (Var.java:383)
    clojure.lang.AFn.applyToHelper (AFn.java:156)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.main.main (main.java:37)

当我也尝试制作第一个项目时,我得到了这个信息:

I get this when I try to make my first project also:

$lein new compojure-app guestbook
java.lang.ClassCastException: clojure.lang.Symbol cannot be cast to java.util.Map$Entry
 at clojure.lang.APersistentMap$ValSeq.first (APersistentMap.java:185)
    clojure.lang.RT.first (RT.java:577)
    clojure.core$first.invoke (core.clj:55)
    clojure.core$map$fn__4245.invoke (core.clj:2559)
    clojure.lang.LazySeq.sval (LazySeq.java:40)
    clojure.lang.LazySeq.seq (LazySeq.java:49)
    clojure.lang.RT.seq (RT.java:484)
    clojure.core$seq.invoke (core.clj:133)
    clojure.core$zipmap.invoke (core.clj:2788)
    leiningen.core.utils$map_vals.doInvoke (utils.clj:115)
    clojure.lang.RestFn.invoke (RestFn.java:442)
    leiningen.core.user/fn (user.clj:69)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invoke (core.clj:624)
    clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
    clojure.lang.RestFn.invoke (RestFn.java:408)
    leiningen.core.user/fn (user.clj:85)
    clojure.lang.AFn.applyToHelper (AFn.java:152)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invoke (core.clj:624)
    clojure.core$memoize$fn__5097.doInvoke (core.clj:5846)
    clojure.lang.RestFn.invoke (RestFn.java:397)
    leiningen.core.project$read_profiles.invoke (project.clj:622)
    leiningen.core.project$project_with_profiles.invoke (project.clj:736)
    leiningen.core.main$_main$fn__5979.invoke (main.clj:358)
    leiningen.core.main$_main.doInvoke (main.clj:353)
    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.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:482)
    clojure.lang.Var.invoke (Var.java:401)
    clojure.lang.AFn.applyToHelper (AFn.java:171)
    clojure.lang.Var.applyTo (Var.java:700)
    clojure.main.main (main.java:37)

这是什么问题?预先谢谢你.

What is the problem here? Thank you in advance.

推荐答案

根据Alex的评论,该问题已通过替换格式错误的.lein/profiles.clj解决了:

As per Alex's comment, the problem was solved by replacing the malformed .lein/profiles.clj:

$nano .lein/profiles.clj
[lein-ancient "0.5.5"]

具有正确形成的轮廓.我使用了此配置文件,该文件位于gist.github.com/devn/4403577:

with a properly formed profile . I used this profile, found at gist.github.com/devn/4403577 :

 {:user {:plugins [[lein-swank "1.4.5"]
;; [lein-pedantic "0.0.5"]
;; [lein-ritz "0.6.0"]
[lein-checkout-deps "1.0.0"]
;; [lein-haml-sass "0.2.4"]
[lein-midje "2.0.1"]
[lein-kibit "0.0.7"]]}
{:dependencies [[slamhound "1.3.0"]]}
{:aliases {"slamhound" ["run" "-m" "slam.hound"]}}}

这篇关于无法运行lein脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-13 00:10