This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-03-03
Channels
- # announcements (3)
- # babashka (29)
- # beginners (95)
- # calva (109)
- # cider (16)
- # clj-kondo (6)
- # cljdoc (2)
- # cljsrn (2)
- # cljtogether (1)
- # clojure (85)
- # clojure-europe (26)
- # clojure-india (1)
- # clojure-seattle (1)
- # clojure-uk (6)
- # clojurescript (14)
- # conjure (4)
- # cursive (8)
- # datomic (6)
- # emacs (21)
- # events (1)
- # figwheel-main (5)
- # fulcro (11)
- # graalvm (32)
- # graphql (1)
- # holy-lambda (7)
- # humbleui (7)
- # jobs (3)
- # membrane (8)
- # nextjournal (31)
- # off-topic (29)
- # pathom (14)
- # polylith (6)
- # portal (16)
- # practicalli (4)
- # reitit (17)
- # releases (1)
- # remote-jobs (2)
- # ring (4)
- # sci (20)
- # shadow-cljs (24)
- # sql (1)
- # vim (12)
- # xtdb (3)
I'm trying figwheel-main and want to integrate it with emacs.
I followed https://docs.cider.mx/cider/cljs/figwheel.html and https://figwheel.org/docs/emacs.html
and my project (lein based) works with lein fig:build
However, when I try to run cider-jack-in-clj&cljs
I get this error
1. Unhandled java.lang.NullPointerException
Null closurePrimitiveNames
AutoValue_Config.java: 196 com.google.javascript.jscomp.parsing.AutoValue_Config$Builder/setClosurePrimitiveNames
ParserRunner.java: 91 com.google.javascript.jscomp.parsing.ParserRunner/createConfig
Compiler.java: 2686 com.google.javascript.jscomp.Compiler/createConfig
Compiler.java: 2667 com.google.javascript.jscomp.Compiler/getParserConfig
JsAst.java: 155 com.google.javascript.jscomp.JsAst/parse
JsAst.java: 55 com.google.javascript.jscomp.JsAst/getAstRoot
externs.clj: 169 cljs.externs/parse-externs
externs.clj: 156 cljs.externs/parse-externs
externs.clj: 204 cljs.externs/externs-map*/fn
protocols.clj: 49 clojure.core.protocols/iter-reduce
protocols.clj: 75 clojure.core.protocols/fn
protocols.clj: 75 clojure.core.protocols/fn
protocols.clj: 13 clojure.core.protocols/fn/G
core.clj: 6830 clojure.core/reduce
core.clj: 6812 clojure.core/reduce
externs.clj: 201 cljs.externs/externs-map*
externs.clj: 185 cljs.externs/externs-map*
externs.clj: 189 cljs.externs/externs-map*
externs.clj: 185 cljs.externs/externs-map*
AFn.java: 154 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 667 clojure.core/apply
core.clj: 6342 clojure.core/memoize/fn
RestFn.java: 408 clojure.lang.RestFn/invoke
env.cljc: 51 cljs.env$default_compiler_env_STAR_/invokeStatic
env.cljc: 46 cljs.env$default_compiler_env_STAR_/invoke
env.cljc: 62 cljs.env$default_compiler_env/invokeStatic
env.cljc: 59 cljs.env$default_compiler_env/invoke
main.cljc: 2172 figwheel.main$default_compile/invokeStatic
main.cljc: 2167 figwheel.main$default_compile/invoke
main.cljc: 2291 figwheel.main$start_STAR_/invokeStatic
main.cljc: 2267 figwheel.main$start_STAR_/doInvoke
...
What can I do to make this work?Haven’t seen this, but it looks like you don’t have a main function in your Clojure-code. Does it work to just jack into clj?
I use https://github.com/bhauman/figwheel-main-template to create projects that work with Cider jack-in
Yeah, I tried that too. It works with the sample project - I'm not sure what's different in my setup. Maybe some dependency conflicts? Compared to the sample project my project has a significant server-side portion and I only include clojurescript relatd dependencies in the dev lein profile.
Randomly clicking through the stacktrace of the error I realized there might be a version conflict.
Cider opened a very old version of closure-compiler
library (v20130603) but I have no idea where it is coming from.
lein deps :tree
only shows v2020315
(I also tried to specify it explicitly in project.clj with the same result).
lein plugins :tree
show an old v2016 version brought in by lein-doo
plugin but it's still not this old v2013 thing.
This is the default command used for cider-jack-in-clj&cljs
/usr/local/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"0.9.0\"\] -- update-in :dependencies conj \[refactor-nrepl/refactor-nrepl\ \"3.3.2\"\] -- update-in :dependencies conj \[cider/piggieback\ \"0.5.2\"\] -- update-in :plugins conj \[refactor-nrepl/refactor-nrepl\ \"3.3.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.28.1\"\] -- update-in :plugins conj \[mx.cider/enrich-classpath\ \"1.9.0\"\] -- update-in :middleware conj cider.enrich-classpath/middleware -- repl :headless :host localhost
I tried using the same thing for deps :tree
but got rather confusing results
lein update-in :dependencies conj \[nrepl/nrepl\ \"0.9.0\"\] -- update-in :dependencies conj \[refactor-nrepl/refactor-nrepl\ \"3.3.2\"\] -- update-in :dependencies conj \[cider/piggieback\ \"0.5.2\"\] -- update-in :plugins conj \[refactor-nrepl/refactor-nrepl\ \"3.3.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.28.1\"\] -- update-in :plugins conj \[mx.cider/enrich-classpath\ \"1.9.0\"\] -- update-in :middleware conj cider.enrich-classpath/middleware -- deps :tree >& deps-cider.out
When I look into deps-cider.out
I see this
less deps-cider.out
...
[com.google.javascript/closure-compiler-unshaded "v20200315" :classifier "javadoc" :exclusions [[*]]]
[com.google.javascript/closure-compiler-unshaded "v20200315" :classifier "sources" :exclusions [[*]]]
[com.google.javascript/closure-compiler-unshaded "v20200315"]
[args4j "2.0.26"]
...
[com.google.javascript/closure-compiler "v20130603" :classifier "javadoc" :exclusions [[*]]]
[com.google.javascript/closure-compiler "v20130603" :classifier "sources" :exclusions [[*]]]
so v20130603 is a top-level dependency but I don't know how that can be - it's definitely not in my project.clj and also not in the dependencies added by the command.
Moreover, it seems there are only javadoc
and sources
but not the standard artifact like there is for closure-compiler-unshaded
If I remove enrich.classpath
there are way less dependencies and the mysterious v20130603 version is gone too!
lein update-in :dependencies conj \[nrepl/nrepl\ \"0.9.0\"\] -- update-in :dependencies conj \[refactor-nrepl/refactor-nrepl\ \"3.3.2\"\] -- update-in :dependencies conj \[cider/piggieback\ \"0.5.2\"\] -- update-in :plugins conj \[refactor-nrepl/refactor-nrepl\ \"3.3.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.28.1\"\] -- deps :tree > deps-cider.out
If I run cider-jack-in-clj&cljs
without enrich.classpath
it works!
/usr/local/bin/lein update-in :dependencies conj \[nrepl/nrepl\ \"0.9.0\"\] -- update-in :dependencies conj \[refactor-nrepl/refactor-nrepl\ \"3.3.2\"\] -- update-in :dependencies conj \[cider/piggieback\ \"0.5.2\"\] -- update-in :plugins conj \[refactor-nrepl/refactor-nrepl\ \"3.3.2\"\] -- update-in :plugins conj \[cider/cider-nrepl\ \"0.28.1\"\] -- repl :headless :host localhost
@U45T93RA6 do you have an idea why is this happening?I've been meaning to cut a new enrich-classpath release, sounds like now it's the time Please clearly save your project as a branch/etc so we can see if the fix worked Thanks!
Kinda bad news unfortunately! https://github.com/clojure-emacs/cider/pull/3164
I don't really know how enrich-classpath works but when I was looking at the list of dependencies and the problem I hit it seemed to me that it's not respecting exclusions and dependency version resolutions and instead it's trying to include every version of every library which could possibly end up on classpath because it's defined as a transitive dependency of some artifact. Even if the actuall classpath (as computed by leiningen) would never contain such artifact. That's why I think I ended up with an ancient version of closure-compiler being loaded by an ancient version of clojurescript
> it seemed to me that it's not respecting exclusions and dependency version resolutions and instead it's trying to include every version of every library which could possibly end up on classpath because it's defined as a transitive dependency of some artifact. Could you describe this in specific terms? A GH issue would be welcome I can actually debug it at some point (for which I'll count on that you've saved this reproducible case as a named branch), but for now a description suffices
@U45T93RA6 here's the issue: https://github.com/clojure-emacs/cider/issues/3167 I managed to create a kind of minimal reproducer: https://github.com/jumarko/figwheel-main-cider-issue
recently started happening for node repls using development tree of spacemacs, and most current shadow-cljs. Attempting to jack-in and/or connect - nrepl dies. There are no significant spacemacs changes aside from enabling clojure layer with LSP. If you need a play project: [email protected]:/Gnurdle/aoc2019.git is intended to be used this way. I'll also add that calva handles this atm, and spacemacs seems like it was working until very recently.