Welcome! Please see the About page for a little more info on how this works.

0 votes
in ClojureScript by
closed by

hi anyone:

I tried to follow the instructions from the "ClojureScript Quick Start", on Windows 10. I tried
both the Ubuntu way in WSL and the powershell way. However, both failed. Ubuntu failed with:

clj -M --main cljs.main --compile hello-world.core --repl
Failed to launch a browser:

No X11 DISPLAY variable was set, but this program performed an operation which requires it.
You can instead launch a non-browser REPL (Node or Nashorn).
You can disable automatic browser launch with this REPL option
:launch-browser false
and you can specify the listen IP address with this REPL option
:host ""
Waiting for browser to connect to http://localhost:9000 ...
ClojureScript 1.10.758

--->>> then how can I open browser with the web? The REPL can type, but respond nothing. (ex: (+ 1 2) give me no feedback at all)

The powershell way failed with:

java -cp "cljs.jar;src" cljs.main --compile hello-world.core --repl
ClojureScript 1.10.758

--->>> then it just hang there, cannot type anything. The localhost:9000 will open, but just keep rolling/waiting, console see no "Hello World!" either.

Is there any way for me to start ClojureScript on Windows 10? docker way, docker in WSL way? any working way, please. Thanks!

closed with the note: solved

4 Answers

+1 vote

If you have node.js installed you can try shadow-cljs. I'm the author and also use Windows so I'm sure it works. ;)


npx create-cljs-project foo
cd foo
npx shadow-cljs browser-repl
# or
npx shadow-cljs node-repl

You can run this in Windows directly or via WSL. When using WSL you might get a warning that a browser cannot be opened automatically. In that case just take the URL and open it in your Browser manually

Failed to open Browser automatically.
Please open the URL below in your Browser:
hi, I tried your steps, I got:

This site can’t provide a secure connectionlocalhost sent an invalid response.

(even if I change https to http)
and in developer tool console, it show:

crbug/1173575, non-JS module files deprecated.

The original command window shows:

shadow-cljs - server version: 2.13.0 running at http://localhost:9630
shadow-cljs - nREPL server started on port 13545
[:browser-repl] Configuring build.
[:browser-repl] Compiling ...
[:browser-repl] Build completed. (119 files, 0 compiled, 0 warnings, 6.38s)
cljs.user=> (+ 3 2)           <<-- I typed later
No available JS runtime.
See https://shadow-cljs.github.io/docs/UsersGuide.html#repl-troubleshootingcljs.user=>
(anonymous) @ (index):5551
Don't use https, the default server uses http only.

The "No available JS runtime" error you get because the browser isn't connected. If you just want a REPL you can use node-repl.

As far as the Browser is concerned you should just open it as a regular webpage. I don't know why it wouldn't open. Which Browser is this? The crbug thing suggests Chrome but the error seems to be from the devtools themselves, so it would not be related to the page you are opening?
0 votes

I just re-visited cljs dev. I started off using figwheel years back, then upgraded to figwheel-main. The readme and related tutorial https://github.com/bhauman/figwheel-main is pretty excellent in discussing what the clojurescript stuff is doing under the hood. They have paths for the CLI and for leiningen (what I use typically). I've been developing a pretty sophisticated SPA in cljs on W10 with emacs connected to a browser repl for the last week or so.

0 votes

hi, I appreciate you people trying to help. I tried figwheel and reagent, and I guess it should be a simpler way. However, I still failed. My steps are:

lein new figwheel hello-world -- --reagent
cd hello-world
npm install
lein figwheel

It is supposed to work, and looks working (no error). However, my web page
working, web page is empty and shows:

This site can’t be reachedThe webpage at might be temporarily down or it may have moved permanently to a new web address.

the developer tool console shows:
crbug/1173575, non-JS module files deprecated.
(anonymous) @ VM1234:5551

I tried the above in Windows 10. However, I also tried in WSL (Ubuntu). It behaves the same. My firewall all turned off, blocking nothing at all. No antivirus software installed either. I really don't understand why this simple function just won't work.

any clue?

0 votes

Thank you guys all! I finally have it figured out myself. I tried some other web frameworks. Finally I found that, I need to use explicit IP (ex: 192.168..... or 172.....), instead of or localhost or I found the problem in Vue.js, so I guess it could be the same for ClojureScript. It indeed is!

I appreciate you all tried to help. You are all nice people. Hope we may help each other some other time. Thanks!