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

failed to require macro-ns "playback.core", it was required by "playback.core", RuntimeException: No such var: server/as-channel #2

Closed
DeadEarnest opened this issue Feb 26, 2024 · 4 comments

Comments

@DeadEarnest
Copy link

Tried to add playback to my project as instructed. Removed Debux and explicitly added:

[org.clojure/clojurescript "1.11.132"]
[org.clojure/clojure "1.11.1"]

Still, I'm getting the error:

File: jar:file:/home/german/.m2/repository/com/github/gnl/playback/0.5.4/playback-0.5.4.jar!/playback/core.cljc
failed to require macro-ns "playback.core", it was required by "playback.core"
Error in phase :compile-syntax-check
RuntimeException: No such var: server/as-channel

full-error.txt
shadow-cljs.txt

@gnl
Copy link
Owner

gnl commented Feb 26, 2024

My guess would be that Portal's reference to server/as-channel here doesn't resolve because something else on your classpath (possibly an older http-kit version) is providing the org.httpkit.server namespace and overriding Portal's dependency there.

Can you check for that and try to create a minimal repro, maybe with a very basic Hello World or template project that uses the same Shadow config, see if you can make it break and then start removing dependencies until it works and you find the culprit.

@DeadEarnest
Copy link
Author

DeadEarnest commented Feb 27, 2024

I found the culprit for compilation error - [figwheel-sidecar "0.5.19"]. After removing it, exception goes away. Thanks for the advice!

I think you should add 2 points to the Quick Start guide:

1. org.clojure/clojurescript and org.clojure/clojure dependencies must be explicitly added to the project.

Without this, running a shadow-cljs project results in the following:
playback kind of works, but a Portal window still doesn't open up on REPL startup. I tried running (playback.core/open-portal!), and it returns:

:repl/exception!
;
; Execution error (TypeError) at (<cljs repl>:1).
; Cannot set properties of null (setting 'onunload')

2. Browsers might block Portal as a pop-up window.

I missed this at first, and thought that playback wasn't working properly.

@gnl
Copy link
Owner

gnl commented Feb 27, 2024

Glad it's working!

  1. org.clojure/clojurescript and org.clojure/clojure dependencies must be explicitly added to the project.

It's generally understood and implicitly assumed that people will manually add Clojure and ClojureScript as their most essential project dependencies; we don't automatically do this in libraries, because it risks overriding someone's chosen version in unpredictable ways. I will however add a note about the required Clojure version being 1.10+.

  1. Browsers might block Portal as a pop-up window.

That's a good point, I'll add a hint, thanks. I'll leave this issue open until I've updated the README.

@gnl
Copy link
Owner

gnl commented Mar 16, 2024

I just updated the README.

One final clarifying note on why this happened exactly – usually an older version of a dependency wouldn't automatically override a newer one when using tools.deps, however the older version of http-kit required by figwheel-sidecar uses the simple name http-kit while the newer one required by Portal uses the fully qualified name http-kit/http-kit, so these are effectively two separate artifacts on the classpath providing the same namespaces, which tends to result in chaos.

@gnl gnl closed this as completed Mar 16, 2024
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

2 participants