简体   繁体   English

如何在clojure中获得有意义的依赖错误?

[英]how to get meaningful dependency errors in clojure?

If I add the following require:如果我添加以下要求:

(ns project.core
  (:require
     [compojure.route          :as route])
  (:gen-class))

(defn -main [& {:as args}]
  (println "hello"))

an do

lein run

I get我得到

Syntax error macroexpanding clojure.core/ns at (ring/util/mime_type.clj:1:1).
((require [clojure.string :as str])) - failed: Extra input spec: :clojure.core.specs.alpha/ns-form

is there a way I can get "compojure.route not found; not defined; or whatever" eg something meaningful?有没有办法让我得到“找不到 compojure.route;未定义;或其他什么”,例如有意义的东西? if I remove it it works fine.如果我删除它,它工作正常。 eg it says Hello例如它说你好

using Leiningen 2.9.4 on Java 14.0.1 OpenJDK 64-Bit Server VM在 Java 14.0.1 OpenJDK 64 位服务器 VM 上使用 Leiningen 2.9.4

The project you are using is using very old dependencies.您正在使用的项目正在使用非常旧的依赖项。 Clojure spec (introduced "recenlty") added macro/compile time checks and the mentioned file there triggers it. Clojure 规范(引入了“recenlty”)添加了宏/编译时间检查,并且那里提到的文件会触发它。

compojure.route actually is found and it then requires its transitive deps. compojure.route实际上被找到,然后它需要它的传递 deps。 And while going down the chain ring.util.mime-type is required and the version you are using is not ready for current Clojure versions.并且在下链时ring.util.mime-type是必需的,并且您正在使用的版本尚未准备好用于当前的 Clojure 版本。

Your best bet here is to upgrade your deps.你最好的办法是升级你的 deps。 Eg if you are following a book or if you are using a template this things can happen.例如,如果您正在阅读一本书或使用模板,则可能会发生这种情况。 If you have lein-ancient installed, it can attempt the update for you.如果您安装了lein-ancient ,它可以为您尝试更新。 Otherwise your best bet is to start in your project.clj and compare versions (eg check clojars).否则你最好的办法是从你的project.clj开始并比较版本(例如检查 clojars)。

If the problem still persists, have a look at lein deps :tree and see what is going on with the transtive deps.如果问题仍然存在,请查看lein deps :tree并查看lein deps :tree发生了什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM