Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enhancement: Improve error message if clojure can't run #25

Open
mfikes opened this issue Apr 30, 2018 · 3 comments
Open

Enhancement: Improve error message if clojure can't run #25

mfikes opened this issue Apr 30, 2018 · 3 comments

Comments

@mfikes
Copy link
Contributor

mfikes commented Apr 30, 2018

project.clj:

(defproject try-lein-tools-deps "0.1.0-SNAPSHOT"
  :plugins [[lein-tools-deps "0.3.0-SNAPSHOT"]]
  :tools/deps [:system :home :project])

deps.edn (malformed):

{:deps {x}}}
$ lein repl
clojure.lang.ExceptionInfo: Unable to locate Clojure's edn files
 at clojure.core$ex_info.invokeStatic (core.clj:4617)
    clojure.core$ex_info.invoke (core.clj:4617)
    clojure.tools.deps.alpha.reader$scrape_clojure_env.invokeStatic (reader.clj:23)
    clojure.tools.deps.alpha.reader$scrape_clojure_env.invoke (reader.clj:18)
    clojure.lang.AFn.applyToHelper (AFn.java:152)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invokeStatic (core.clj:646)
    clojure.core$memoize$fn__5708.doInvoke (core.clj:6107)
    clojure.lang.RestFn.invoke (RestFn.java:397)
    lein_tools_deps.plugin$make_dep_loc_lookup.invokeStatic (plugin.clj:19)
    lein_tools_deps.plugin$make_dep_loc_lookup.invoke (plugin.clj:14)
    lein_tools_deps.plugin$canonicalise_dep_locs.invokeStatic (plugin.clj:28)
    lein_tools_deps.plugin$canonicalise_dep_locs.invoke (plugin.clj:27)
    lein_tools_deps.plugin$middleware.invokeStatic (plugin.clj:93)
    lein_tools_deps.plugin$middleware.invoke (plugin.clj:85)
    clojure.lang.Var.invoke (Var.java:379)
    leiningen.core.project$apply_middleware.invokeStatic (project.clj:801)
    leiningen.core.project$apply_middleware.invoke (project.clj:794)
    clojure.lang.ArrayChunk.reduce (ArrayChunk.java:58)
    clojure.core.protocols$fn__6750.invokeStatic (protocols.clj:136)
    clojure.core.protocols/fn (protocols.clj:124)
    clojure.core.protocols$fn__6710$G__6705__6719.invoke (protocols.clj:19)
    clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31)
    clojure.core.protocols$fn__6738.invokeStatic (protocols.clj:75)
    clojure.core.protocols/fn (protocols.clj:75)
    clojure.core.protocols$fn__6684$G__6679__6697.invoke (protocols.clj:13)
    clojure.core$reduce.invokeStatic (core.clj:6545)
    clojure.core$reduce.invoke (core.clj:6527)
    leiningen.core.project$apply_middleware.invokeStatic (project.clj:796)
    leiningen.core.project$apply_middleware.invoke (project.clj:794)
    leiningen.core.project$activate_middleware.invokeStatic (project.clj:828)
    leiningen.core.project$activate_middleware.invoke (project.clj:824)
    leiningen.core.project$init_project.invokeStatic (project.clj:952)
    leiningen.core.project$init_project.invoke (project.clj:942)
    leiningen.core.project$read.invokeStatic (project.clj:1023)
    leiningen.core.project$read.invoke (project.clj:1020)
    leiningen.core.project$read.invokeStatic (project.clj:1024)
    leiningen.core.project$read.invoke (project.clj:1020)
    leiningen.core.main$_main$fn__4734.invoke (main.clj:416)
    leiningen.core.main$_main.invokeStatic (main.clj:411)
    leiningen.core.main$_main.doInvoke (main.clj:408)
    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.invokeStatic (core.clj:646)
    clojure.main$main_opt.invokeStatic (main.clj:314)
    clojure.main$main_opt.invoke (main.clj:310)
    clojure.main$main.invokeStatic (main.clj:421)
    clojure.main$main.doInvoke (main.clj:384)
    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)

If you were to run clojure directly yourself you get more info:

$ clojure
Error building classpath. Map literal must contain an even number of forms
java.lang.RuntimeException: Map literal must contain an even number of forms
	at clojure.lang.Util.runtimeException(Util.java:221)
	at clojure.lang.EdnReader$MapReader.invoke(EdnReader.java:682)
	at clojure.lang.EdnReader.readDelimitedList(EdnReader.java:757)
	at clojure.lang.EdnReader$MapReader.invoke(EdnReader.java:680)
	at clojure.lang.EdnReader.read(EdnReader.java:145)
	at clojure.lang.EdnReader.read(EdnReader.java:111)
	at clojure.edn$read.invokeStatic(edn.clj:35)
	at clojure.edn$read.invoke(edn.clj:14)
	at clojure.tools.deps.alpha.util.io$slurp_edn.invokeStatic(io.clj:29)
	at clojure.tools.deps.alpha.util.io$slurp_edn.invoke(io.clj:22)
	at clojure.tools.deps.alpha.reader$slurp_edn_map.invokeStatic(reader.clj:38)
	at clojure.tools.deps.alpha.reader$slurp_edn_map.invoke(reader.clj:35)
	at clojure.tools.deps.alpha.reader$slurp_deps.invokeStatic(reader.clj:58)
	at clojure.tools.deps.alpha.reader$slurp_deps.invoke(reader.clj:54)
	at clojure.core$map$fn__5587.invoke(core.clj:2745)
	at clojure.lang.LazySeq.sval(LazySeq.java:40)
	at clojure.lang.LazySeq.seq(LazySeq.java:49)
	at clojure.lang.Cons.next(Cons.java:39)
	at clojure.lang.RT.boundedLength(RT.java:1785)
	at clojure.lang.RestFn.applyTo(RestFn.java:130)
	at clojure.core$apply.invokeStatic(core.clj:659)
	at clojure.core$apply.invoke(core.clj:652)
	at clojure.tools.deps.alpha.reader$merge_deps.invokeStatic(reader.clj:73)
	at clojure.tools.deps.alpha.reader$merge_deps.invoke(reader.clj:70)
	at clojure.tools.deps.alpha.reader$read_deps.invokeStatic(reader.clj:78)
	at clojure.tools.deps.alpha.reader$read_deps.invoke(reader.clj:75)
	at clojure.tools.deps.alpha.script.make_classpath$combine_deps_files.invokeStatic(make_classpath.clj:47)
	at clojure.tools.deps.alpha.script.make_classpath$combine_deps_files.invoke(make_classpath.clj:43)
	at clojure.tools.deps.alpha.script.make_classpath$run.invokeStatic(make_classpath.clj:68)
	at clojure.tools.deps.alpha.script.make_classpath$run.invoke(make_classpath.clj:64)
	at clojure.tools.deps.alpha.script.make_classpath$_main.invokeStatic(make_classpath.clj:109)
	at clojure.tools.deps.alpha.script.make_classpath$_main.doInvoke(make_classpath.clj:84)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:702)
	at clojure.core$apply.invokeStatic(core.clj:657)
	at clojure.main$main_opt.invokeStatic(main.clj:317)
	at clojure.main$main_opt.invoke(main.clj:313)
	at clojure.main$main.invokeStatic(main.clj:424)
	at clojure.main$main.doInvoke(main.clj:387)
	at clojure.lang.RestFn.applyTo(RestFn.java:137)
	at clojure.lang.Var.applyTo(Var.java:702)
	at clojure.main.main(main.java:37)

Perhaps this involves an upstream enhancement in tools.deps.alpha, or alternatively, lein-tools-deps can run clojure -Sdescribe itself and show :err?

@ezmiller
Copy link

+1

I was getting the same vague error message: "Unable to locate Clojure's edn files". I ran clojure and the error message told me immediately what I needed to know to fix the problem.

@vladanghene
Copy link

vladanghene commented Jan 1, 2020

running into this issue a year later, did some developing on mac and now switched to ubuntu where there's no clj client out of the box apparently, running clojure gets me into user ns with no problem, still don't know what's missing but it appears to be related dependencies ?! :

clojure.lang.ExceptionInfo: Unable to locate Clojure's edn files
{:exit 1, :out "", :err "Exception in thread \"main\" java.io.FileNotFoundException: -Sdescribe (No such file or directory)\n\tat java.base/java.io.FileInputStream.open0(Native Method)\n\tat java.base/java.io.FileInputStream.open(FileInputStream.java:219)\n\tat java.base/java.io.FileInputStream.<init>(FileInputStream.java:157)\n\tat java.base/java.io.FileInputStream.<init>(FileInputStream.java:112)\n\tat clojure.lang.Compiler.loadFile(Compiler.java:7314)\n\tat clojure.main$load_script.invokeStatic(main.clj:275)\n\tat clojure.main$load_script.invoke(main.clj:268)\n\tat clojure.main$script_opt.invokeStatic(main.clj:337)\n\tat clojure.main$script_opt.invoke(main.clj:330)\n\tat clojure.main$main.invokeStatic(main.clj:421)\n\tat clojure.main$main.doInvoke(main.clj:384)\n\tat clojure.lang.RestFn.invoke(RestFn.java:408)\n\tat clojure.lang.Var.invoke(Var.java:379)\n\tat clojure.lang.AFn.applyToHelper(AFn.java:154)\n\tat clojure.lang.Var.applyTo(Var.java:700)\n\tat clojure.main.main(main.java:37)\n"}
 at lein_tools_deps.env$scrape_clojure_env.invokeStatic (env.clj:35)
    lein_tools_deps.env$scrape_clojure_env.invoke (env.clj:27)
    clojure.lang.AFn.applyToHelper (AFn.java:154)
    clojure.lang.AFn.applyTo (AFn.java:144)
    clojure.core$apply.invokeStatic (core.clj:665)
    clojure.core$memoize$fn__6862.doInvoke (core.clj:6353)
....

can't run lein deps even, get the same error.

@vladanghene
Copy link

vladanghene commented Jan 1, 2020

apparently clj is not in apt-get repos and it's not sufficient to just have clojure cli on ubuntu.
okay, so basically I had to install the clj client (props to this article) and that got me clj which was needed to clone the github repos I was using in my deps.edn
thanks for the lein-tools-deps by the way, big fan !
now I can run my aliases in peace : clj -A:build-dev (I use figwheel's default)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants