This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-11-02
Channels
- # announcements (3)
- # aws (8)
- # babashka (87)
- # babashka-sci-dev (3)
- # beginners (34)
- # calva (35)
- # clerk (2)
- # clj-commons (47)
- # cljdoc (10)
- # cljs-dev (21)
- # clojure (19)
- # clojure-android (1)
- # clojure-austin (2)
- # clojure-europe (30)
- # clojure-nl (1)
- # clojure-norway (67)
- # clojure-uk (9)
- # clojuredesign-podcast (7)
- # clojurescript (24)
- # code-reviews (20)
- # cursive (6)
- # datomic (12)
- # emacs (14)
- # events (1)
- # fulcro (7)
- # gratitude (1)
- # hoplon (8)
- # hyperfiddle (23)
- # juxt (22)
- # meander (11)
- # nyc (3)
- # overtone (2)
- # podcasts-discuss (1)
- # reagent (3)
- # releases (1)
- # sci (27)
- # shadow-cljs (73)
- # squint (4)
- # thejaloniki (3)
- # xtdb (7)
I'm attempting to run "Fire up the Clojurescript Quickstart Browser REPL", but the browser does not launch and I see this in the calva-output pane
; Creating cljs repl session...
; Connecting cljs repl: deps.edn + ClojureScript built-in for browser...
; The Calva Connection Log might have more connection progress information.
; Execution error (BindException) at
Address already in use (Bind failed)
; Failed starting cljs repl
; Jack-in done.
How do I debug this? I don't see any additional information in the Calva Connection Log. What port is the code trying to bind to?
ps:I'm new to Clojure
Looking into the temp folder, under out/clojure/browser/repl.cljs I see
(goog-define HOST "localhost")
(goog-define PORT 9000)
changing it to 9001 does not help either..
I also changed it in repl.js. Still the same result.
I do notice that the VPN ZScaler is listening on 9000. Not sure how to change the port to a different value.
Hmmm. I think the port may be hard coded as a default deep in there some how. Please file an issue about this. I will see if I can make Calva override the default. Meanwhile, to test some ClojureScript, the Node Quick Start should work. For testing with a browser app, you can check this template project out: https://github.com/PEZ/shadow-bare-bones It is a bit less basic, but also a bit more realistic, than Calva’s quick-start browser thing. Still very basic, though. And you’ll have an actual project to build from, which is a pretty big bonus. Please let me know how you fare. Here’s a similarly bare bones Clojure-only template: https://github.com/PEZ/clojure-get-started-mini The README there has some tips on resources for Clojure beginners. And I can truly recommend the #beginners channel on this slack. Super friendly and helpful people there!
Thanks! I killed the ZScaler VPN and was able to launch the app. I will create an issue for this. I'm using this as a playground for code that I want to run in Ryan Robitaille's data-rabbit. I'll try the shadow-bare-bones!
Oh, I data-rabbit is on my bucket list. Then you really want to have a small project, because the Quick Start stuff is launched from your tmp folder and might get lost. If you prefer the minimalness of the CLJS quick starter, you can of course copy it out of the temp folder to wherever you have your projects. The project folder is everything before src/
in the path of the .cljs
file that the quick starter opens. Then you open this project and use Calva’s Jack-in command to start and connect the repl, choosing the deps.edn + ClojureScript built-in for browser as the project type.
Hey Peter @pez! Hope you’re doing great 👋 I have a question whether you’re aware of a small issue. Every time I try to connect to a REPL inside my team’s monorepo, I first select the project folder (I wish the most commonly used folders would be on the top, but that’s a minor one :)), and then I’m presented with “Please select a project type”. Every first time I open this list, I don’t see options like “deps.edn” for Clojure projects, and “shadow-cljs” for CLJS projects. If I open this list the second time, both of these options are present. I’m fairly used to this workflow now so it’s not a biggie, but I was encouraging a co-worker to use more REPL, and they were quite confused with this behaviour. So I’m curious if this is known, and maybe it’s a difficult issue to solve? Thanks!
Hey Misha, long time no see! I am doing great. Hoping the same for you. You shouldn’t wait with feedback like that about that you want the most commonly used project root first in that list. 😃 I think I’ve seen it suggested before, so we should create an issue for that and see what we can do without things getting complicated. As for the main issue. I don’t think we are aware of it. But tbh, I’m not sure I am following. I take it as that the project type menu has options, but lacks some options you expect to be there? So you need to retry and then list is correctly populated? If this is correctly understood by me, then I can’t reproduce it. I’m guessing we have a race condition. (It’s super ugly stateful stuff going on there, so would not surprise me.) Issue welcome! Making it two welcomed issues. 😃
> As for the main issue. I don’t think we are aware of it. But tbh, I’m not sure I am following. I take it as that the project type menu has options, but lacks some options you expect to be there? So you need to retry and then list is correctly populated? Yes, correct. I’ll share the video of the repro with you. Let me know if you need any more info! 🙏
I added this issue. https://github.com/BetterThanTomorrow/calva/issues/2334
Still can’t reproduce. But maybe I found the problem. Can you test this VSIX? https://output.circle-artifacts.com/output/job/9784c285-3401-4a47-8ec0-6116bde4a037/artifacts/0/tmp/artifacts/calva-2.0.398-2334-populate-project-types-from-cold-1a22f698.vsix
So, that one didn’t fix it. But maybe this one does: https://output.circle-artifacts.com/output/job/bfd0a195-f52a-400b-be3a-efd25f1e2c20/artifacts/0/tmp/artifacts/calva-2.0.399-2334-populate-project-types-from-cold-7021cb97.vsix @U05H8N9V0HZ ^
Doesn't help
Can you test the VSIX ending with 7021xb97
, @U9ES37CSZ? A VSIX is a zip package that VS Code (and VS too, I think) extensions come wrapped in. You install it from the VS Code Extensions pane, top meatballs menu -> Install from VSIX…. Sometimes when downloading them, they get renamed to .zip
for some reason. Then VS Code won’t find it.
I removed the old .vsix files and tried again, but no joy yet:
Sorry for the confusion. I installed the wrong one again.
Now I've installed calva-2.0.399-2334-populate-project-types-from-cold-7021cb97.zip
and it is working as expected for my situation.
My repro is (on Linux): • ctl-shift P • Developer: Reload Window • ctl-shift P • Calva: Connect to a Running REPL Server in the Project
Just confirmed with @pez that the fix is working 👍 I wasn’t properly installing the vsix file
@pez let me test once more...
Yep. Works. Thought I saw it not work again...
I think that the fact that I couldn’t reproduce it indicates that there is still some bug hiding in there. The whole thing is way more stateful than any Clojure coder wants to imagine. I wasn’t a Clojure coder when I wrote most of it… Haha. I think we will have to rewrite it considerably at some point soon.
I have a namespace that looks like this:
(ns server
(:require [org.httpkit.server :refer [run-server]]
[stasis.core :refer [serve-pages]]
[web :refer [pages]]))
(defonce server (atom nil))
(def app (serve-pages pages))
(defn stop []
(when-some [s @server]
(s :timeout 100)
(reset! server nil)))
(defn start []
(stop)
(reset! server (-> #'app
(run-server {:port 8080}))))
(comment
(start)
(stop))
The start
function is used to start a web server to preview my static website in the web browser while I work on my pages.
After starting my REPL, I manually run the start function within the comment block.
But is there a way to automatically run the start
function every time the REPL starts?Or maybe Calva can use an entry point like this? :thinking_face:
(ns main
(:require [server :as s])
(:gen-class))
(defn -main [& args]
(s/start))
Which would typically be run from the terminal like so:
clj -M -m main
You can create a https://calva.io/connect-sequences/ and configure afterCLJReplJackInCode
there to require the server
namespace and start the server.
You can also do it in your entry point function, but that gets more complicated, because you will also need to make it start the nREPL server, which is done in Calva’s default entry point.
dot-less top namespaces are discouraged, by the way. Something Java something something reason.