Open SebAlbert opened 1 month ago
Hey Sebastian! I hope everything is going well.
In short, every time you start a new project and run it with shadow-cljs
, by default the /dashboard
path will always be initialized, after all, it is through this path that you will be able to see your active builds, your active runtimes and your HTTP servers (with their routes). In this case, in the top menu you can see that you can still navigate to builds
(where you can force or stop the build of your project), runtimes
(where you can explore your active runtime), inspect
and inspect-latest
to view inspections performed (with taps). The repl-js/browser-repl
path is nothing more than an instance of your repl running in the browser, allowing you to evaluate your code and see it being executed in the browser (so you can, for example, evaluate something like (js/alert "hey")
and check if it was executed correctly).
The purpose of the dashboard is to provide this broader view and allow you to inspect your project and its active instances in a more pragmatic way. I actually agree with you that perhaps these explanations should be more easily accessible in the Shadow CLJS User’s Guide
.
Until then, I would like to say that I actually got to know this dashboard when I was studying Fulcro, in the explanatory videos published by Tony Kay (the attached link is exactly when I first came across this dashboard).
I believe I have understood your question, but if there is any misunderstanding on my part, please correct me. I hope this helps you!
Cheers
Hi Guto and thanks for your nice, newbie-friendly explanation!
I am a bit confused about Fulcro and the term "compilation server" (which I both never heard of before). Am I supposed to be using Fulcro, or would Fulcro be employed by shadow-cljs behind the scenes? If so, it seems like it's only halfway integrated when starting npx shadow-cljs browser-repl
without any real project files, i.e., it exists as the /dashboard route which is the redirect destination of the /
route, but it endlessly says "Loading..." Or is that npx shadow-cljs browser-repl
command (or some larger part of shadow-cljs which the browser-repl is contained in) only meant for those who happen to be using Fulcro?
If all the answers are "no", which would not surprise me, then it still comes down to my phrased issue that only putting the correct URL (route) in the automagically opened browser -- and not on the terminal output as well" -- excludes users who run just plain shadow-cljs from a machine without a browser (probably without XDG or the like) and would access it via the network from a different machine.
The parts on Fulcro and the explanations are certainly a good source of further knowledge and understanding for me.
Thanks Sebastian
Which version did you use in all of this? There were some buggy versions a while ago where the /dashboard
was buggy and never got beyond Loading ...
. This is the UI of shadow-cljs btw. You can start/stop/observe builds from there and it hosts Inspect. It isn't directly related to the browser-repl
though, as that is its own thing not intergrated with the UI. (Fulcro isn't necessary or used by shadow-cljs btw, it was just a demo video showing how you'd use shadow-cljs with Fulcro).
I'm uncertain what the exact issue is though.
Here is what I did in WSL:
$ npx create-cljs-project brepl
shadow-cljs - creating project: /mnt/c/Users/thheller/code/tmp/brepl
Creating: /mnt/c/Users/thheller/code/tmp/brepl/package.json
Creating: /mnt/c/Users/thheller/code/tmp/brepl/shadow-cljs.edn
Creating: /mnt/c/Users/thheller/code/tmp/brepl/.gitignore
Creating: /mnt/c/Users/thheller/code/tmp/brepl/src/main
Creating: /mnt/c/Users/thheller/code/tmp/brepl/src/test
----
Installing shadow-cljs in project.
...
Then change into that brepl
dir and
$ npx shadow-cljs browser-repl
shadow-cljs - config: /mnt/c/Users/thheller/code/tmp/brepl/shadow-cljs.edn
shadow-cljs - updating dependencies
shadow-cljs - dependencies updated
[2024-09-30 10:12:37.448 - WARNING] TCP Port 9630 in use.
shadow-cljs - server version: 2.28.15 running at http://localhost:9631
shadow-cljs - nREPL server started on port 65428
[:browser-repl] Configuring build.
[:browser-repl] Compiling ...
[:browser-repl] Build completed. (118 files, 117 compiled, 0 warnings, 5.52s)
Failed to open Browser automatically.
Please open the URL below in your Browser:
http://localhost:9631/repl-js/browser-repl
cljs.user=>
Note that it printed the URL to open?
That's interesting, my output was a bit terser:
~/src$ npx create-cljs-project uxdev
Need to install the following packages:
create-cljs-project@0.0.15
Ok to proceed? (y)
shadow-cljs - creating project: /home/seb/src/uxdev
Creating: /home/seb/src/uxdev/package.json
Creating: /home/seb/src/uxdev/shadow-cljs.edn
Creating: /home/seb/src/uxdev/.gitignore
Creating: /home/seb/src/uxdev/src/main
Creating: /home/seb/src/uxdev/src/test
----
Installing shadow-cljs in project.
added 105 packages, and audited 106 packages in 22s
16 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
----
Done. Actual project initialization will follow soon.
----
then:
~/src/uxdev$ npx shadow-cljs browser-repl
shadow-cljs - config: /home/seb/src/uxdev/shadow-cljs.edn
shadow-cljs - updating dependencies
Retrieving thheller/shadow-cljs/2.28.15/shadow-cljs-2.28.15.pom from https://repo.clojars.org/
Retrieving org/clojure/clojure/1.11.1/clojure-1.11.1.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/data.json/2.4.0/data.json-2.4.0.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/clojure/1.9.0/clojure-1.9.0.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/spec.alpha/0.1.143/spec.alpha-0.1.143.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/core.specs.alpha/0.1.24/core.specs.alpha-0.1.24.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/tools.cli/1.0.206/tools.cli-1.0.206.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/clojure/1.8.0/clojure-1.8.0.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/tools.reader/1.4.2/tools.reader-1.4.2.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/pom.contrib/1.2.0/pom.contrib-1.2.0.pom from https://repo1.maven.org/maven2/
Retrieving nrepl/nrepl/1.3.0/nrepl-1.3.0.pom from https://repo.clojars.org/
Retrieving cider/piggieback/0.5.3/piggieback-0.5.3.pom from https://repo.clojars.org/
Retrieving com/cognitect/transit-clj/1.0.329/transit-clj-1.0.329.pom from https://repo1.maven.org/maven2/
Retrieving com/cognitect/transit-java/1.0.362/transit-java-1.0.362.pom from https://repo1.maven.org/maven2/
Retrieving javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.pom from https://repo1.maven.org/maven2/
Retrieving javax/xml/bind/jaxb-api-parent/2.3.0/jaxb-api-parent-2.3.0.pom from https://repo1.maven.org/maven2/
Retrieving net/java/jvnet-parent/5/jvnet-parent-5.pom from https://repo1.maven.org/maven2/
Retrieving com/cognitect/transit-cljs/0.8.280/transit-cljs-0.8.280.pom from https://repo1.maven.org/maven2/
Retrieving com/cognitect/transit-js/0.8.874/transit-js-0.8.874.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/core.async/1.5.648/core.async-1.5.648.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/clojure/1.5.1/clojure-1.5.1.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/core.memoize/1.0.253/core.memoize-1.0.253.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/core.cache/1.0.225/core.cache-1.0.225.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/data.priority-map/1.1.0/data.priority-map-1.1.0.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/clojure/1.6.0/clojure-1.6.0.pom from https://repo1.maven.org/maven2/
Retrieving org/ow2/asm/asm/9.2/asm-9.2.pom from https://repo1.maven.org/maven2/
Retrieving org/ow2/ow2/1.5/ow2-1.5.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/tools.reader/1.3.6/tools.reader-1.3.6.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/clojurescript/1.11.132/clojurescript-1.11.132.pom from https://repo1.maven.org/maven2/
Retrieving com/google/javascript/closure-compiler-unshaded/v20240317/closure-compiler-unshaded-v20240317.pom from https://repo1.maven.org/maven2/
Retrieving com/google/javascript/closure-compiler-main/v20240317/closure-compiler-main-v20240317.pom from https://repo1.maven.org/maven2/
Retrieving com/google/javascript/closure-compiler-parent/v20240317/closure-compiler-parent-v20240317.pom from https://repo1.maven.org/maven2/
Retrieving args4j/args4j/2.33/args4j-2.33.pom from https://repo1.maven.org/maven2/
Retrieving args4j/args4j-site/2.33/args4j-site-2.33.pom from https://repo1.maven.org/maven2/
Retrieving org/kohsuke/pom/14/pom-14.pom from https://repo1.maven.org/maven2/
Retrieving com/google/code/gson/gson/2.9.1/gson-2.9.1.pom from https://repo1.maven.org/maven2/
Retrieving com/google/code/gson/gson-parent/2.9.1/gson-parent-2.9.1.pom from https://repo1.maven.org/maven2/
Retrieving com/google/errorprone/error_prone_annotations/2.18.0/error_prone_annotations-2.18.0.pom from https://repo1.maven.org/maven2/
Retrieving com/google/errorprone/error_prone_parent/2.18.0/error_prone_parent-2.18.0.pom from https://repo1.maven.org/maven2/
Retrieving com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.pom from https://repo1.maven.org/maven2/
Retrieving com/google/guava/guava-parent/26.0-android/guava-parent-26.0-android.pom from https://repo1.maven.org/maven2/
Retrieving com/google/guava/guava/32.1.2-jre/guava-32.1.2-jre.pom from https://repo1.maven.org/maven2/
Retrieving com/google/guava/guava-parent/32.1.2-jre/guava-parent-32.1.2-jre.pom from https://repo1.maven.org/maven2/
Retrieving com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.pom from https://repo1.maven.org/maven2/
Retrieving org/checkerframework/checker-qual/3.33.0/checker-qual-3.33.0.pom from https://repo1.maven.org/maven2/
Retrieving com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.pom from https://repo1.maven.org/maven2/
Retrieving com/google/protobuf/protobuf-java/3.21.12/protobuf-java-3.21.12.pom from https://repo1.maven.org/maven2/
Retrieving com/google/protobuf/protobuf-parent/3.21.12/protobuf-parent-3.21.12.pom from https://repo1.maven.org/maven2/
Retrieving com/google/protobuf/protobuf-bom/3.21.12/protobuf-bom-3.21.12.pom from https://repo1.maven.org/maven2/
Retrieving com/google/re2j/re2j/1.3/re2j-1.3.pom from https://repo1.maven.org/maven2/
Retrieving org/apache/ant/ant/1.10.11/ant-1.10.11.pom from https://repo1.maven.org/maven2/
Retrieving org/apache/ant/ant-parent/1.10.11/ant-parent-1.10.11.pom from https://repo1.maven.org/maven2/
Retrieving org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11.pom from https://repo1.maven.org/maven2/
Retrieving org/jspecify/jspecify/0.2.0/jspecify-0.2.0.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541.pom from https://repo1.maven.org/maven2/
Retrieving org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541.pom from https://repo1.maven.org/maven2/
Retrieving thheller/shadow-util/0.7.0/shadow-util-0.7.0.pom from https://repo.clojars.org/
Retrieving org/clojure/clojure/1.2.1/clojure-1.2.1.pom from https://repo1.maven.org/maven2/
Retrieving thheller/shadow-client/1.4.0/shadow-client-1.4.0.pom from https://repo.clojars.org/
Retrieving thheller/shadow-undertow/0.3.4/shadow-undertow-0.3.4.pom from https://repo.clojars.org/
Retrieving io/undertow/undertow-core/2.3.10.Final/undertow-core-2.3.10.Final.pom from https://repo1.maven.org/maven2/
Retrieving io/undertow/undertow-parent/2.3.10.Final/undertow-parent-2.3.10.Final.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/jboss-parent/35/jboss-parent-35.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/logging/jboss-logging/3.4.3.Final/jboss-logging-3.4.3.Final.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/jboss-parent/39/jboss-parent-39.pom from https://repo1.maven.org/maven2/
Retrieving org/junit/junit-bom/5.8.2/junit-bom-5.8.2.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/xnio/xnio-api/3.8.8.Final/xnio-api-3.8.8.Final.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/xnio/xnio-all/3.8.8.Final/xnio-all-3.8.8.Final.pom from https://repo1.maven.org/maven2/
Retrieving org/wildfly/common/wildfly-common/1.5.4.Final/wildfly-common-1.5.4.Final.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/jboss-parent/34/jboss-parent-34.pom from https://repo1.maven.org/maven2/
Retrieving org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/jboss-parent/23/jboss-parent-23.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/logging/jboss-logging/3.3.1.Final/jboss-logging-3.3.1.Final.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/jboss-parent/15/jboss-parent-15.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/xnio/xnio-nio/3.8.8.Final/xnio-nio-3.8.8.Final.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/threads/jboss-threads/2.3.6.Final/jboss-threads-2.3.6.Final.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/jboss-parent/20/jboss-parent-20.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/threads/jboss-threads/3.5.0.Final/jboss-threads-3.5.0.Final.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/jboss-parent/36/jboss-parent-36.pom from https://repo1.maven.org/maven2/
Retrieving org/jboss/logging/jboss-logging/3.4.1.Final/jboss-logging-3.4.1.Final.pom from https://repo1.maven.org/maven2/
Retrieving thheller/shadow-cljsjs/0.0.22/shadow-cljsjs-0.0.22.pom from https://repo.clojars.org/
Retrieving ring/ring-core/1.9.6/ring-core-1.9.6.pom from https://repo.clojars.org/
Retrieving org/clojure/clojure/1.7.0/clojure-1.7.0.pom from https://repo1.maven.org/maven2/
Retrieving ring/ring-codec/1.2.0/ring-codec-1.2.0.pom from https://repo.clojars.org/
Retrieving commons-io/commons-io/2.11.0/commons-io-2.11.0.pom from https://repo1.maven.org/maven2/
Retrieving org/junit/junit-bom/5.7.2/junit-bom-5.7.2.pom from https://repo1.maven.org/maven2/
Retrieving crypto-random/crypto-random/1.2.1/crypto-random-1.2.1.pom from https://repo.clojars.org/
Retrieving crypto-equality/crypto-equality/1.0.1/crypto-equality-1.0.1.pom from https://repo.clojars.org/
Retrieving io/methvin/directory-watcher/0.17.1/directory-watcher-0.17.1.pom from https://repo1.maven.org/maven2/
Retrieving net/java/dev/jna/jna/5.12.1/jna-5.12.1.pom from https://repo1.maven.org/maven2/
Retrieving org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.pom from https://repo1.maven.org/maven2/
Retrieving org/slf4j/slf4j-parent/1.7.36/slf4j-parent-1.7.36.pom from https://repo1.maven.org/maven2/
Retrieving expound/expound/0.9.0/expound-0.9.0.pom from https://repo.clojars.org/
Retrieving fipp/fipp/0.6.26/fipp-0.6.26.pom from https://repo.clojars.org/
Retrieving org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2.pom from https://repo1.maven.org/maven2/
RetrievingRetrieving org/clojure/data.json/2.4.0/data.json-2.4.0.jar from https://repo1.maven.org/maven2/
org/clojure/clojure/1.11.1/clojure-1.11.1.jar from https://repo1.maven.org/maven2/
Retrieving org/clojure/tools.cli/1.0.206/tools.cli-1.0.206.jar from https://repo1.maven.org/maven2/
Retrieving org/clojure/tools.reader/1.4.2/tools.reader-1.4.2.jar from https://repo1.maven.org/maven2/
Retrieving com/cognitect/transit-clj/1.0.329/transit-clj-1.0.329.jar from https://repo1.maven.org/maven2/
Retrieving com/cognitect/transit-java/1.0.362/transit-java-1.0.362.jar from https://repo1.maven.org/maven2/
Retrieving javax/xml/bind/jaxb-api/2.3.0/jaxb-api-2.3.0.jar from https://repo1.maven.org/maven2/
Retrieving com/cognitect/transit-cljs/0.8.280/transit-cljs-0.8.280.jar from https://repo1.maven.org/maven2/
Retrieving org/clojure/core.async/1.5.648/core.async-1.5.648.jar from https://repo1.maven.org/maven2/
Retrieving org/clojure/tools.analyzer.jvm/1.2.2/tools.analyzer.jvm-1.2.2.jar from https://repo1.maven.org/maven2/
Retrieving org/clojure/tools.analyzer/1.1.0/tools.analyzer-1.1.0.jar from https://repo1.maven.org/maven2/
Retrieving com/cognitect/transit-js/0.8.874/transit-js-0.8.874.jar from https://repo1.maven.org/maven2/
Retrieving Retrieving org/clojure/core.cache/1.0.225/core.cache-1.0.225.jar org/clojure/core.memoize/1.0.253/core.memoize-1.0.253.jarfrom from https://repo1.maven.org/maven2/https://repo1.maven.org/maven2/
Retrieving org/clojure/data.priority-map/1.1.0/data.priority-map-1.1.0.jar from https://repo1.maven.org/maven2/
Retrieving org/ow2/asm/asm/9.2/asm-9.2.jar from https://repo1.maven.org/maven2/
Retrieving org/clojure/clojurescript/1.11.132/clojurescript-1.11.132.jar from https://repo1.maven.org/maven2/
Retrieving com/google/javascript/closure-compiler-unshaded/v20240317/closure-compiler-unshaded-v20240317.jar from https://repo1.maven.org/maven2/
Retrieving args4j/args4j/2.33/args4j-2.33.jar from https://repo1.maven.org/maven2/
Retrieving com/google/code/gson/gson/2.9.1/gson-2.9.1.jar from https://repo1.maven.org/maven2/
Retrieving com/google/errorprone/error_prone_annotations/2.18.0/error_prone_annotations-2.18.0.jar from https://repo1.maven.org/maven2/
Retrieving com/google/guava/failureaccess/1.0.1/failureaccess-1.0.1.jar from https://repo1.maven.org/maven2/
Retrieving com/google/guava/guava/32.1.2-jre/guava-32.1.2-jre.jar from https://repo1.maven.org/maven2/
Retrieving com/google/guava/listenablefuture/9999.0-empty-to-avoid-conflict-with-guava/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar from https://repo1.maven.org/maven2/
Retrieving org/checkerframework/checker-qual/3.33.0/checker-qual-3.33.0.jar from https://repo1.maven.org/maven2/
Retrieving com/google/j2objc/j2objc-annotations/2.8/j2objc-annotations-2.8.jar from https://repo1.maven.org/maven2/
Retrieving com/google/protobuf/protobuf-java/3.21.12/protobuf-java-3.21.12.jar from https://repo1.maven.org/maven2/
Retrieving com/google/re2j/re2j/1.3/re2j-1.3.jar from https://repo1.maven.org/maven2/
Retrieving org/apache/ant/ant-launcher/1.10.11/ant-launcher-1.10.11.jar from https://repo1.maven.org/maven2/
Retrieving org/apache/ant/ant/1.10.11/ant-1.10.11.jar from https://repo1.maven.org/maven2/
Retrieving org/jspecify/jspecify/0.2.0/jspecify-0.2.0.jar from https://repo1.maven.org/maven2/
Retrieving org/clojure/google-closure-library/0.0-20230227-c7c0a541/google-closure-library-0.0-20230227-c7c0a541.jar from https://repo1.maven.org/maven2/
Retrieving org/clojure/google-closure-library-third-party/0.0-20230227-c7c0a541/google-closure-library-third-party-0.0-20230227-c7c0a541.jar from https://repo1.maven.org/maven2/
Retrieving io/undertow/undertow-core/2.3.10.Final/undertow-core-2.3.10.Final.jar from https://repo1.maven.org/maven2/
Retrieving org/jboss/logging/jboss-logging/3.4.3.Final/jboss-logging-3.4.3.Final.jar from https://repo1.maven.org/maven2/
Retrieving org/jboss/xnio/xnio-api/3.8.8.Final/xnio-api-3.8.8.Final.jar from https://repo1.maven.org/maven2/
Retrieving org/wildfly/common/wildfly-common/1.5.4.Final/wildfly-common-1.5.4.Final.jar from https://repo1.maven.org/maven2/
Retrieving org/wildfly/client/wildfly-client-config/1.0.1.Final/wildfly-client-config-1.0.1.Final.jar from https://repo1.maven.org/maven2/
Retrieving org/jboss/xnio/xnio-nio/3.8.8.Final/xnio-nio-3.8.8.Final.jar from https://repo1.maven.org/maven2/
Retrieving org/jboss/threads/jboss-threads/3.5.0.Final/jboss-threads-3.5.0.Final.jar from https://repo1.maven.org/maven2/
Retrieving commons-io/commons-io/2.11.0/commons-io-2.11.0.jar from https://repo1.maven.org/maven2/
Retrieving io/methvin/directory-watcher/0.17.1/directory-watcher-0.17.1.jar from https://repo1.maven.org/maven2/
Retrieving net/java/dev/jna/jna/5.12.1/jna-5.12.1.jar from https://repo1.maven.org/maven2/
Retrieving org/slf4j/slf4j-api/1.7.36/slf4j-api-1.7.36.jar from https://repo1.maven.org/maven2/
Retrieving org/clojure/core.rrb-vector/0.1.2/core.rrb-vector-0.1.2.jar from https://repo1.maven.org/maven2/
Retrieving thheller/shadow-client/1.4.0/shadow-client-1.4.0.jar from https://repo.clojars.org/
Retrieving thheller/shadow-cljs/2.28.15/shadow-cljs-2.28.15-aot.jar from https://repo.clojars.org/
Retrieving thheller/shadow-util/0.7.0/shadow-util-0.7.0.jar from https://repo.clojars.org/
Retrieving nrepl/nrepl/1.3.0/nrepl-1.3.0.jar from https://repo.clojars.org/
Retrieving cider/piggieback/0.5.3/piggieback-0.5.3.jar from https://repo.clojars.org/
Retrieving thheller/shadow-cljsjs/0.0.22/shadow-cljsjs-0.0.22.jar from https://repo.clojars.org/
Retrieving thheller/shadow-undertow/0.3.4/shadow-undertow-0.3.4.jar from https://repo.clojars.org/
Retrieving ring/ring-codec/1.2.0/ring-codec-1.2.0.jar from https://repo.clojars.org/
Retrieving ring/ring-core/1.9.6/ring-core-1.9.6.jar from https://repo.clojars.org/
Retrieving crypto-equality/crypto-equality/1.0.1/crypto-equality-1.0.1.jar from https://repo.clojars.org/
Retrieving crypto-random/crypto-random/1.2.1/crypto-random-1.2.1.jar from https://repo.clojars.org/
Retrieving fipp/fipp/0.6.26/fipp-0.6.26.jar from https://repo.clojars.org/
Retrieving expound/expound/0.9.0/expound-0.9.0.jar from https://repo.clojars.org/
shadow-cljs - dependencies updated
shadow-cljs - server version: 2.28.15 running at http://localhost:9630
shadow-cljs - nREPL server started on port 36407
[:browser-repl] Configuring build.
[:browser-repl] Compiling ...
[:browser-repl] Build completed. (118 files, 117 compiled, 0 warnings, 9.56s)
cljs.user=> (print "Hello")
No available JS runtime.
See https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshootingcljs.user=>
(js/console.log "Hello")
No available JS runtime.
See https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshootingcljs.user=>
(js/console.log "Hello")
No available JS runtime.
See https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshootingcljs.user=>
^C
I am on Clojure 1.11.3, npm 9.2.0, OpenJDK 17.0.12 with an up-to-date Debian 12.
shadow-cljs reports being version 2.28.15 ("via npm").
I do have the environment variables XDG_RUNTIME_DIR="/mnt/wslg/runtime-dir"
and WAYLAND_DISPLAY="wayland-0"
and WSL2_GUI_APPS_ENABLED="1"
, which may be making a difference in behaviour, because I experimented with a graphical IDE from within WSL2 once. I do not have any browser installed on WSL2, though, so nothing opened.
Unsetting all those environment variables, including DISPLAY
, still yields only this output in a freshly created shadow-cljs project:
~/src/brepl$ npx shadow-cljs browser-repl
shadow-cljs - config: /home/seb/src/brepl/shadow-cljs.edn
shadow-cljs - updating dependencies
Retrieving thheller/shadow-cljs/2.28.16/shadow-cljs-2.28.16.pom from https://repo.clojars.org/
Retrieving thheller/shadow-cljs/2.28.16/shadow-cljs-2.28.16-aot.jar from https://repo.clojars.org/
shadow-cljs - dependencies updated
shadow-cljs - server version: 2.28.16 running at http://localhost:9630
shadow-cljs - nREPL server started on port 39125
[:browser-repl] Configuring build.
[:browser-repl] Compiling ...
[:browser-repl] Build completed. (118 files, 117 compiled, 0 warnings, 7.29s)
cljs.user=> (+ 3 4)
No available JS runtime.
See https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshootingcljs.user=>
Just to be clear, I got the basic repl working by now, it's just the out-of-the-box experience that seems to be broken w.r.t. not mentioning the URL for the Browser REPL on my setup for unknown reasons.
This is the code opening the Browser and then printing the URL should that fail.
I suspect that it is just silently failing and not throwing an Exception. Thus shadow-cljs thinks it worked and doesn't print anything. I'm still on WSL1, so that might be the difference. I'll try to reproduce WSL2 later.
I also traced it down to browse-url. Invoking on my side looks like this:
~$ clj
Clojure 1.11.3
user=> (use 'clojure.java.browse)
nil
user=> (browse-url "http://clojuredocs.org")
true
user=> (System/getProperty "os.name")
"Linux"
Reading through https://github.com/clojure/clojure/blob/ebcbdb65e12152fff23f53c2f43c17d783f9e800/src/clj/clojure/java/browse.clj
I think it boils down to xdg-open
being present on my $PATH, but browse-url not checking the result of the call and happily returning true in any case.
As I don't know how involved it would be to change that behaviour upstream (it might break other uses), I think the easiest way to resolve my issue would be for shadow-cljs to print the URL anyway, not only after an Exception.
P.S.:
xdg-open
apparently returns 3 if no browser installed:
~$ xdg-open https://clojuredocs.org
/usr/bin/xdg-open: 882: x-www-browser: not found
/usr/bin/xdg-open: 882: firefox: not found
/usr/bin/xdg-open: 882: iceweasel: not found
/usr/bin/xdg-open: 882: seamonkey: not found
/usr/bin/xdg-open: 882: mozilla: not found
/usr/bin/xdg-open: 882: epiphany: not found
/usr/bin/xdg-open: 882: konqueror: not found
/usr/bin/xdg-open: 882: chromium: not found
/usr/bin/xdg-open: 882: chromium-browser: not found
/usr/bin/xdg-open: 882: google-chrome: not found
/usr/bin/xdg-open: 882: www-browser: not found
/usr/bin/xdg-open: 882: links2: not found
/usr/bin/xdg-open: 882: elinks: not found
/usr/bin/xdg-open: 882: links: not found
/usr/bin/xdg-open: 882: lynx: not found
/usr/bin/xdg-open: 882: w3m: not found
xdg-open: no method available for opening 'https://clojuredocs.org'
~$ echo $?
3
Hi and thanks for an apparently very cool library!
I just tried starting out on Windows inside WSL2 with the npx quickstart. The WSL2 won't open a browser automagically when I start
npx shadow-cljs browser-repl
. Instead I took the terminal output and tried toGET /
on the local IP, which redirected me to/dashboard
, which only showed "Loading..." and nothing else, with the web-socket connected and sending ping and pong. I spent quite some time trying to figure out what could be wrong.It was only after trying on another machine with a graphical environment where I saw that the automagically opened browser is pointed to a different URL (
/repl-js/browser-repl
). Typing this on the first machine with the WSL2 setting also immediately works. If only I had known this earlier. So, bottom line, I think the URL to open in the browser should be printed on the console when starting browser-repl in a vanilla quickstarted project.N.B.: What is that
dashboard
anyway? Cannot seem to find that term in the UserGuide anywhere, though there are some closed Github issues containing that term.