Closed snichme closed 7 years ago
I can reproduce the error, but unfortunately I don't know what's causing it, or how to work around it.
It's either a bug in Figwheel, or a bug in ClojureScript. ClojureScript is the latest version, but the Figwheel dependency lags behind a little.
I'll probably be updating Figwheel sometime soon, but because Figwheel has no stable low-level API, it usually takes a few days of effort to upgrade, even between minor versions. It's a huge timesink.
I don't know whether upgrading Figwheel will help or not, but when I get around to doing that, you can try updating and see if that will help. Until then, I'm afraid I can't think of anything to help.
If I do a lein clean
and remove target directory and rerun the same as above I first get this error:
java.lang.IllegalStateException: Alias env already exists in namespace cljs.core, aliasing cljs.env, compiling:(cljs/core.cljc:1:1)
And after that it seems like all requires are messed up. In my core.cljs I get
WARNING: Use of undeclared Var dapp.core/read at line 26
WARNING: Use of undeclared Var dapp.core/mutate at line 27
WARNING: Use of undeclared Var dapp.core/parser at line 34
WARNING: Use of undeclared Var dapp.core/transit-post at line 35
WARNING: Use of undeclared Var dapp.core/reconciler at line 44
WARNING: Use of undeclared Var dapp.core/atom at line 49
WARNING: Use of undeclared Var cljs.core/not at line 51
WARNING: Use of undeclared Var cljs.core/deref at line 51
WARNING: Use of undeclared Var dapp.core/mounted? at line 51
WARNING: Use of undeclared Var dapp.core/app at line 53
WARNING: Use of undeclared Var dapp.core/app at line 54
WARNING: Use of undeclared Var dapp.core/swap! at line 55
WARNING: Use of undeclared Var dapp.core/mounted? at line 55
WARNING: Use of undeclared Var dapp.core/not at line 55
WARNING: Use of undeclared Var dapp.core/app at line 57
WARNING: Use of undeclared Var dapp.core/app at line 59
WARNING: Use of undeclared Var dapp.core/get at line 60
WARNING: Use of undeclared Var dapp.core/app at line 60
and in ui.cljs the same as above, something with the required macro defui.
Maybe this could help
Hope below helps, below is the stacktrace I got when (reset).
java.lang.NullPointerException: null
at clojure.core$deref_future.invokeStatic (core.clj:2297)
clojure.core$deref.invokeStatic (core.clj:2317)
clojure.core$deref.invoke (core.clj:2303)
cljs.analyzer$parse_ns$fn__4635.invoke (analyzer.cljc:3381)
cljs.analyzer$parse_ns.invokeStatic (analyzer.cljc:3353)
cljs.analyzer$parse_ns.invoke (analyzer.cljc:3332)
cljs.analyzer$parse_ns.invokeStatic (analyzer.cljc:3343)
cljs.analyzer$parse_ns.invoke (analyzer.cljc:3332)
cljs.compiler$find_source.invokeStatic (compiler.cljc:1508)
cljs.compiler$find_source.invoke (compiler.cljc:1507)
clojure.core$map$fn__5406.invoke (core.clj:2735)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:56)
clojure.lang.RT.seq (RT.java:525)
clojure.core$seq__4944.invokeStatic (core.clj:137)
clojure.core$reduce1.invokeStatic (core.clj:922)
clojure.core$set.invokeStatic (core.clj:4065)
clojure.core$set.invoke (core.clj:4057)
cljs.closure$add_dependency_sources.invokeStatic (closure.clj:833)
cljs.closure$add_dependency_sources.invoke (closure.clj:825)
cljs.closure$build.invokeStatic (closure.clj:2288)
cljs.closure$build.invoke (closure.clj:2222)
cljs.build.api$build.invokeStatic (api.clj:202)
cljs.build.api$build.invoke (api.clj:189)
figwheel_sidecar.components.cljs_autobuild$cljs_build.invokeStatic (cljs_autobuild.clj:28)
figwheel_sidecar.components.cljs_autobuild$cljs_build.invoke (cljs_autobuild.clj:27)
figwheel_sidecar.build_middleware.injection$hook$fn__52523.invoke (injection.clj:197)
figwheel_sidecar.components.cljs_autobuild$notify_command_hook$fn__52903.invoke (cljs_autobuild.clj:68)
figwheel_sidecar.components.cljs_autobuild$figwheel_start_and_end_messages$fn__52895.invoke (cljs_autobuild.clj:48)
figwheel_sidecar.build_middleware.notifications$hook$fn__52764.invoke (notifications.clj:179)
figwheel_sidecar.build_middleware.clj_reloading$hook$fn__52821.invoke (clj_reloading.clj:94)
figwheel_sidecar.build_middleware.javascript_reloading$hook$fn__52854.invoke (javascript_reloading.clj:48)
figwheel_sidecar.components.cljs_autobuild$color_output$fn__52907.invoke (cljs_autobuild.clj:79)
duct.server.figwheel$start_build.invokeStatic (figwheel.clj:79)
duct.server.figwheel$start_build.invoke (figwheel.clj:78)
duct.server.figwheel$build_cljs.invokeStatic (figwheel.clj:99)
duct.server.figwheel$build_cljs.invoke (figwheel.clj:93)
duct.server.figwheel$eval53374$fn__53376.invoke (figwheel.clj:107)
clojure.lang.MultiFn.invoke (MultiFn.java:233)
integrant.core$try_build_action.invokeStatic (core.cljc:199)
integrant.core$try_build_action.invoke (core.cljc:198)
integrant.core$build_key.invokeStatic (core.cljc:206)
integrant.core$build_key.invoke (core.cljc:203)
clojure.core$partial$fn__5380.invoke (core.clj:2605)
clojure.core.protocols$fn__7665.invokeStatic (protocols.clj:167)
clojure.core.protocols/fn (protocols.clj:124)
clojure.core.protocols$fn__7620$G__7615__7629.invoke (protocols.clj:19)
clojure.core.protocols$seq_reduce.invokeStatic (protocols.clj:31)
clojure.core.protocols$fn__7648.invokeStatic (protocols.clj:75)
clojure.core.protocols/fn (protocols.clj:75)
clojure.core.protocols$fn__7594$G__7589__7607.invoke (protocols.clj:13)
clojure.core$reduce.invokeStatic (core.clj:6704)
clojure.core$reduce.invoke (core.clj:6686)
integrant.core$build.invokeStatic (core.cljc:221)
integrant.core$build.invoke (core.cljc:209)
integrant.core$init.invokeStatic (core.cljc:276)
integrant.core$init.invoke (core.cljc:268)
integrant.core$init.invokeStatic (core.cljc:273)
integrant.core$init.invoke (core.cljc:268)
integrant.repl$resume$fn__54518.invoke (repl.clj:46)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.lang.Var.alterRoot (Var.java:305)
clojure.core$alter_var_root.invokeStatic (core.clj:5414)
clojure.core$alter_var_root.doInvoke (core.clj:5409)
clojure.lang.RestFn.invoke (RestFn.java:425)
integrant.repl$resume.invokeStatic (repl.clj:46)
integrant.repl$resume.invoke (repl.clj:42)
clojure.lang.Var.invoke (Var.java:377)
clojure.tools.namespace.repl$do_refresh.invokeStatic (repl.clj:100)
clojure.tools.namespace.repl$do_refresh.invoke (repl.clj:82)
clojure.tools.namespace.repl$refresh.invokeStatic (repl.clj:145)
clojure.tools.namespace.repl$refresh.doInvoke (repl.clj:128)
clojure.lang.RestFn.invoke (RestFn.java:421)
integrant.repl$reset.invokeStatic (repl.clj:52)
integrant.repl$reset.invoke (repl.clj:50)
dev$eval73007.invokeStatic (form-init492288447919556848.clj:131)
dev$eval73007.invoke (form-init492288447919556848.clj:131)
clojure.lang.Compiler.eval (Compiler.java:7005)
clojure.lang.Compiler.eval (Compiler.java:6968)
clojure.core$eval.invokeStatic (core.clj:3194)
clojure.core$eval.invoke (core.clj:3190)
clojure.main$repl$read_eval_print__8372$fn__8375.invoke (main.clj:242)
clojure.main$repl$read_eval_print__8372.invoke (main.clj:242)
clojure.main$repl$fn__8381.invoke (main.clj:260)
clojure.main$repl.invokeStatic (main.clj:260)
clojure.main$repl.doInvoke (main.clj:176)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invokeStatic (core.clj:657)
clojure.core$apply.invoke (core.clj:652)
refactor_nrepl.ns.slam.hound.regrow$wrap_clojure_repl$fn__28303.doInvoke (regrow.clj:18)
clojure.lang.RestFn.invoke (RestFn.java:1523)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__1127.invoke (interruptible_eval.clj:87)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invokeStatic (core.clj:657)
clojure.core$with_bindings_STAR_.invokeStatic (core.clj:1970)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1970)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invokeStatic (interruptible_eval.clj:85)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:55)
clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__1172$fn__1175.invoke (interruptible_eval.clj:222)
clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__1167.invoke (interruptible_eval.clj:190)
clojure.lang.AFn.run (AFn.java:22)
java.util.concurrent.ThreadPoolExecutor.runWorker (ThreadPoolExecutor.java:1142)
java.util.concurrent.ThreadPoolExecutor$Worker.run (ThreadPoolExecutor.java:617)
java.lang.Thread.run (Thread.java:745)
I've got similar issue and decided to have a look at upgrading Figwheel.
I've not managed to fix the issue yet, however: if Duct Figwheel should be updated to the latest Figwheel version in the near future, then it's worth noting that Figwheel will ignore files with names which begin with cljs
when reloading.
I thought that I should mention it here, given that this Figwheel peculiarity could result in a potentially confusing time-sink for one of us.
I would like to tentatively state that I believe I've fixed this issue with reset
in my particular codebase, which also has shared cljc
Reagent templates as well as clj
and cljs
files.
The issue was fixed by telling clojure.tools.namespace
which directories to scan during refresh, and hence work out the correct dependency order before reloading namespaces.
I believe this is seen in Duct template apps because of the dev
directory which is at the same level as src
, but I could be wrong. Certainly the original reporter of this issue @snichme has the following additional source paths in his project file:
:project/dev {:source-paths ["dev/src/clj" "dev/src/cljc"]
... and I have a similar config.
Nonetheless, the fix is to put something like the following in a namespace which is loaded by the REPL:
(clojure.tools.namespace.repl/set-refresh-dirs "dev" "src" "test")
In a Duct project this would typically be at the bottom of the my-project-name.dev
namespace in the dev.clj
file .
So this doesn't seem to be an issue with module.cljs
itself, but it might be worth tweaking the Duct template if this turns out to fix other peoples issues.
Downside is that the unsuspecting user of the template would have to know about this extra config location and keep both code locations updated/synced with these source path values. 🤔
And I can confirm that adding that line for setting refresh dirs solve it for me as well.
Ah, excellent. Thanks for the diagnosis @scottlowe, and the confirmation @snichme. I'll add the extra line to the template.
Not sure if this is an issue or just something with my setup (in latter case I need help)
I have a project where I'm using om.next and when I start up duct everything works fine but after any change in a .cljs file and a
(reset)
the compilation fails, see log belowI should also mention that doing a
(clear)
doesn't help, but it works again after restarting the repl.I don't know where to begin looking so if anyone know why this happens or could point me where I should start to look.
No matter what I change it always complains about the same thing.
project.clj
ui.cljs