I installed the latest clojure-msi version (1252) and now am getting this error (🧵). Does this look familiar to anyone?
$ clj -Sverbose -Srepro
deps.clj version = 1.11.1.1252
version = 1.11.1.1224
install_dir = C:\Users\justin\AppData\Local\Apps\clojure\
config_dir = C:\Users\justin\.config\clojure
config_paths = C:\Users\justin\AppData\Local\Apps\clojure\deps.edn C:\Users\justin\.config\clojure\deps.edn deps.edn
cache_dir = .cpcache
cp_file = .cpcache\795F3581F76A585DE3044ED0B7DE8FED.cp
Refreshing classpath
Error building classpath. Cannot invoke "java.io.File.getParentFile()" because "the_file" is null
java.lang.NullPointerException: Cannot invoke "java.io.File.getParentFile()" because "the_file" is null
at $write_file.invokeStatic(io.clj:52)
at clojure.tools.deps.script.make_classpath2$run.invokeStatic(make_classpath2.clj:188)
at clojure.tools.deps.script.make_classpath2$_main.invokeStatic(make_classpath2.clj:228)
at clojure.tools.deps.script.make_classpath2$_main.doInvoke(make_classpath2.clj:195)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.main$main_opt.invokeStatic(main.clj:514)
at clojure.main$main_opt.invoke(main.clj:510)
at clojure.main$main.invokeStatic(main.clj:664)
at clojure.main$main.doInvoke(main.clj:616)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:40) Are you running this in or outside a project? (Not that it should matter, both should work)
it was the same on both... wait this is only happening in the emacs shells, seems to work in powershell
Going to try the old "restart everything trick", it might be that
and in cmd.exe?
it seems a nil is passed here:
https://github.com/clojure/tools.deps/blob/6cfa31355278b34a71b8e85d24da1663827ff193/src/main/clojure/clojure/tools/deps/util/io.clj#L48
Not sure why
yup works there too. I think it has to do with emacs seeing the wrong environment variables (despite restarting it)
ok
Ah yeah, that was it. I had another instance of emacs open that was causing it to not refresh the env. working now. Thanks for looking
so with which env var not set did you get the error?
XDG_CACHE or so?
I think it might have been JAVA_HOME? as that was giving me another issue that seemed related, but haven't verified that that's used in tools.deps
I don't see how JAVA_HOME would cause the above error, it seems tools deps was writing to a directory that didn't exist or so
hmm I do use the XDG_CONFIG_HOME for clojure but I don't think that would have been unset. So now I'm not so sure it was that. Going to see if I can reproduce it
maybe if you set XDG_CONFIG_HOME or CACHE_HOME to a non-existing directory or empty string, the error could happen?
I can trigger a warning with that, but different:
$ XDG_CACHE_HOME="" bb clojure
Error building classpath. Can't create directory: /clojure
Exception in thread "main" java.io.FileNotFoundException: /clojure/940AA8FA0E8C78469532CDFC872761FE.cp (No such file or directory)Yup that seems to be it for me:
> $env:XDG_CACHE_HOME = ''; clj
Error building classpath. Cannot invoke "java.io.File.getParentFile()" because "the_file" is null
java.lang.NullPointerException: Cannot invoke "java.io.File.getParentFile()" because "the_file" is null
at $write_file.invokeStatic(io.clj:52)
at clojure.tools.deps.script.make_classpath2$run.invokeStatic(make_classpath2.clj:188)
at clojure.tools.deps.script.make_classpath2$_main.invokeStatic(make_classpath2.clj:228)
at clojure.tools.deps.script.make_classpath2$_main.doInvoke(make_classpath2.clj:195)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.core$apply.invokeStatic(core.clj:667)
at clojure.main$main_opt.invokeStatic(main.clj:514)
at clojure.main$main_opt.invoke(main.clj:510)
at clojure.main$main.invokeStatic(main.clj:664)
at clojure.main$main.doInvoke(main.clj:616)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at clojure.lang.Var.applyTo(Var.java:705)
at clojure.main.main(main.java:40) arg wait no sorry that was in an old shell with the bad env at least I have that to look at now one sec
Not sure if this is the cause but it seems related: DEPS_CLJ_TOOLS_VERSION was pointing to the old version that was no longer installed in the stale env. And which doesn't exist as a directory in ~/.deps.clj/ I can't immediately see how that leads to the exact error. On a quick glance it seems like it could cause issues in deps.clj, such as here: https://github.com/borkdude/deps.clj/blob/b2356ff4b28e3b115479d2d3d6e4135bf20f9150/deps.clj#L614-L618
ah yes, that can surely mess things up
since the older or newer tools version will or won't pass certain things like jvm-file, basis-file, etc
there lately have been some changes there