-
-
Notifications
You must be signed in to change notification settings - Fork 172
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
[shadow-cljs] Invalid :refer, var taoensso.encore/have does not exist #364
Comments
@BorisKourt Hi Boris, apologies for the trouble! It looks like you need to update your version of Encore. That should solve your problem, just make sure to run |
Thank you for such a fast response, unfortunately (with a clean run as well) I am still getting this issue on [:app] Compiling ...
------ ERROR -------------------------------------------------------------------
File: jar:file:/Users/<~>/.m2/repository/com/taoensso/timbre/6.0.3/timbre-6.0.3.jar!/taoensso/timbre/appenders/core.cljc:1:1
--------------------------------------------------------------------------------
1 | (ns taoensso.timbre.appenders.core
-------^------------------------------------------------------------------------
Invalid :refer, var taoensso.encore/have does not exist
--------------------------------------------------------------------------------
2 | "Core Timbre appenders without any special dependency requirements.
3 | These can be aliased into the main Timbre ns for convenience."
4 | {:author "Peter Taoussanis (@ptaoussanis)"}
5 | (:require
-------------------------------------------------------------------------------- I also already had encore at latest on Clojars: [com.taoensso/timbre "6.0.3" :exclusions [com.taoensso/encore]]
[com.taoensso/encore "3.42.0"] (test with and without exclusions earlier) |
@BorisKourt Is there a chance something else is bringing in an older version of Encore? I'm not too familiar with shadow-cljs, but this appears to be an identical issue to taoensso/encore#64, which should have hopefully been resolved with Encore If you can confirm that you really have the latest Encore and are seeing the issue, could you please try with In that case, I'll try get it running locally so that I can debug properly. Thanks, and again sorry for the trouble! |
Hey I checked using I then downgraded to Syntax error macroexpanding at (timbre.cljc:15:1).
Execution error (ExceptionInfo) at taoensso.encore/assert-min-encore-version (encore.cljc:1499).
Insufficient `com.taoensso/encore` version, you may have a dependency conflict: see http://goo.gl/qBbLvC for solutions. I am not sure which version of timbre to downgrade to to fix this. Since if I go far enough back the original issue can go away. Thanks for taking the time! |
Ah, sorry about that. I've just pushed Could you please try with that? If it's still no good, I'll try get setup with shadow-cljs later today or tomorrow so that I can debug properly myself. |
Hey, this is working with this snapshot. |
Okay, great- thanks for the confirmation 👍 Will try get setup with shadow so I can debug properly myself, after which I'll push new versions of Encore and Timbre. In the meantime, I believe that the following combination should work: [com.taoensso/encore "3.37.1"]
[com.taoensso/timbre "6.0.2"] Again, sorry about the nuisance. |
Thank you very much! I will keep an eye out for new versions. |
@BorisKourt I'm having some trouble reproducing the problem. Here's the minimal project I'm using: https://github.com/ptaoussanis/temp-timbre-364
:dependencies
[[com.taoensso/encore "3.42.0"]
[com.taoensso/timbre "6.0.3"]] And using The init ns contents: (ns foo
(:require
[taoensso.encore :as enc]
[taoensso.timbre :as timbre]
[taoensso.timbre.appenders.core]
))
(defn init []
(js/alert (enc/have string? "hello 1"))
(timbre/info (enc/have string? "hello 2"))
) I'm then running: npx shadow-cljs browser-repl
npx shadow-cljs watch frontend and opening Is there something in particular I need to do to trigger the error? |
Update: can confirm that my example project does confirm the problem with Is it possible that your shadow-cljs has outdated build artifacts? Might it be worth trying to clear your entire js output dir if you haven't already. |
I will try to create my own repro example. I am using shadow via lein, directly from the luminus +shadow template. Though it has now been many months in development, so a lot going on in here. Regarding the second comment: As far as I know I have cleared all cached output. It seems like its all in |
Not sure about luminus + shadow template, not familiar with either of those. But at least with the vanilla shadow-cljs, it seems to generate js files in the
I would definitely think so, yes. But not sure why I can't reproduce on my side. Weird things can definitely occur if stale build artifacts are somehow lingering. If it's non-trivial for you to try create your own repro (which I can totally understand), I'd maybe recommend starting with my example project - just to rule out the possibility that you're seeing different results even with that. What version of Cljs, and what compiler options are you using for your own project that's exhibiting the problem? Is this an |
Quick answer first before I dig in further, this is an |
Thanks for clarifying 👍 Just tried Will continue investigating so long. |
Just an update. I tried creating a new Luminus app with +shadow-cljs and adding timbre and encore. After doing a bunch of permutations of versions and settings I couldn't reproduce the issue. Sadly going back to the original project and trying with anything but the snapshot you provided I am still getting the error. I am trying to figure out what the main differences are between this existing project and a fresh Luminus setup. But I am assuming that its something on my end and not yours. |
Thanks for keeping me updated 👍 My best guess would still be that there's stale build artifacts squirrelled away somewhere. I'd try search in your base project dir for any .js files - might turn up an unexpected cache dir? |
I have just tested removing: With these deps I still get the same error: [com.taoensso/timbre "6.0.3" :exclusions [com.taoensso/encore]]
[com.taoensso/encore "3.42.0"]] With these I do not: [com.taoensso/timbre "6.0.2" :exclusions [com.taoensso/encore]]
[com.taoensso/encore "3.37.1"]] Its really weird that it persists if I change these back and forth. |
This is definitely unexpected. If we've ruled out dependency conflict and stale build artifacts, then the only other explanation I can think of right now is that there's indeed a problem in Encore or Timbre, but it requires some specific context (e.g. compiler options and/or versions of other software) to show up. I'm not so familiar with shadow-cljs though, and completely unfamiliar with luminus - so could be I'm missing something else. Is it possible that your old project (the one exhibiting) problems is using an older version of shadow-cljs, or ClojureScript? Would it be possible to share the config related to your Cljs build? I've just pushed |
Hey, I ran with: [com.taoensso/timbre "6.0.3" :exclusions [com.taoensso/encore]]
[com.taoensso/encore "3.42.0-timbre364"]] And it still gives me the error. I am using the latest version of most libraries (regularly check via I will try to see if I can duplicate this project and just strip away everything else. See if its something with the way its configured. |
Are you by any chance using clj-kondo in your project that's experiencing the trouble? |
Hey, I have isolated it to just shadow, timbre and encore: https://github.com/BorisKourt/timbre-repro Hopefully it will be possible to reproduce the error on your end. Steps:
I am not sure if you need On my machine that triggers the error every time. I have removed all dev profiles and dependencies. So only lein uberjar will work. But that seems to be where the error happens consistently. |
Can confirm that I'm seeing the same error with your repo and steps above 👍 |
So that was quite a trip down the rabbit hole ^^ Would you please try one more time using Thanks again for the repro, that was a huge help - and I understand it must have taken a lot of effort to find. Quick summaryIt looks like there might be some sort of issue with shadow-cljs, or something else in your reproducible example (some config, interaction, etc.). I've found what I hope is a reliable fix/workaround that can be made in Encore, though I don't understand exactly what the underlying issue is or why the workaround seems to help. Digging into this further could be a lot of effort for not much benefit, but I'll leave some crumbs below for posterity or if someone else feels curious enough to dig. Usual disclaimer that I may be missing something stupid/obvious! DetailsBasically the problem appears to be this: If we have a form like However, somehow, the Clojure (not ClojureScript) The This confusion appears to happen only when using shadow-cljs, and even then only in specific circumstances (e.g. your specific repro), though I'm not certain what the key factors are. BTW your repro example can actually be simplified and Timbre can be removed. The fix/workaroundIt looks like adding an I might be missing an obvious reason why the extra I'm not familiar with any of the relevant compiler internals, so can't speculate as to what might be going on. Encore's |
Thanks for taking the time on this, really appreciate it! That is quite an unexpected issue. Everything appears to be working with I wonder who this should be passed on to? I can't quite tell if its shadow exposing a clojure bug or just a shadow issue. |
…empt) Previous attempted fix was unsuccessful, this one should hopefully work.
You're very welcome. Likewise thanks for all the help, and sorry for all your time sunk on this.
I'm inclined not to bother anyone else about this unless the problem recurs. If there is an underlying cause, it seems likely that it's triggered only in obscure circumstances. The current fix/workaround appears to be reliable, so I'm happy to leave it as is for now. If the problem does recur, I'll dig further into what might actually be going on underneath - either to change the approach, or to ping the relevant upstream folks with clearer info. Does that sound reasonable to you? |
That sounds totally reasonable. Lets close this one :) |
When compiling for production with shadow-cljs I get this error from the last few versions of Timbre.
Version 5.2.1 is working fine.
I have not been able to pinpoint an exact place in the changelog that starts to have this issue. But I guess it is related to the shuffling of community appenders?
Thanks for any suggestions!
The text was updated successfully, but these errors were encountered: