代码之家  ›  专栏  ›  技术社区  ›  R71

不能用lein运行环

  •  2
  • R71  · 技术社区  · 8 年前

    我正试着与ring和lein一起第一次跑步,但我在跑步时遇到了一些问题。我从《Clojure的Web开发》一书的第1章,以及 https://quickleft.com/blog/your-first-clojure-web-app/ 。这两个站点的代码给了我相同的错误-找不到类。

    我有以下项目。clj

    (defproject myfirstwebapp "0.1.1"
       :description "A hello world for a Ring based web app"
       :dependencies [[org.clojure/clojure "1.8.0"]
                 [ring "1.4.0"]]
       :plugins [[lein-ring "0.9.7"]]
       :dev-dependencies [[lein-ring "0.9.7"]]
       :ring {:handler myfirstwebapp.core/app})
    

    下面的core.clj

    (ns myfirstwebapp.core)
    (defn app [req]
      {:status 200
       :headers {"content-Type" "text/html"}
       :body "Hello World!"})
    

    我运行的命令是:

    lein new myfirstwebapp
    edit project.clj as above
    cd myfirstwebapp
    lein deps
    edit src/myfirstwebapp/core.clj as above
    lein ring server
    

    现在我遇到了如下错误:

    线程“main”java.lang.ClassNotFoundException:leiningen.core中出现异常。项目$reduce_repo_step,编译:(C:\Users\ROG\form-init7789757414629005682.clj:1:17608)

    我使用的不同组件版本之间是否存在不匹配?还是别的什么?

    1 回复  |  直到 8 年前
        1
  •  1
  •   DanLebrero    8 年前

    这是一个 bug in lein 2.6.0 。在2.6.1中固定