0

Following the Quick Start wiki page of ClojureScript, I'm trying to have the REPL inside Chrome web browser (as seen there: https://github.com/clojure/clojurescript/wiki/Quick-Start#browser-repl)

I'm running on Windows and I'm skipping the "brew rlwrap" part because I'm clueless about what it should mean to a Windows user and the link to rlwrap is broken.

When I run the command java -cp "cljs.jar;src" clojure.main repl.clj in the console then open "http://localhost:9000/" on the browser, I can see java app (cls.jar) crashes.

Exception in thread "Thread-3" java.util.regex.PatternSyntaxException: Illegal/unsupported escap e sequence near index 7 g:\Dev\Clojurescript ^ at java.util.regex.Pattern.error(Unknown Source) at java.util.regex.Pattern.escape(Unknown Source) at java.util.regex.Pattern.atom(Unknown Source) at java.util.regex.Pattern.sequence(Unknown Source) at java.util.regex.Pattern.expr(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at java.util.regex.Pattern.(Unknown Source) at java.util.regex.Pattern.compile(Unknown Source) at cljs.repl.browser$send_static.invokeStatic(browser.clj:108) at cljs.repl.browser$send_static.invoke(browser.clj:92) at cljs.repl.server$dispatch_request.invokeStatic(server.clj:157) at cljs.repl.server$handle_connection.invokeStatic(server.clj:164) at cljs.repl.server$server_loop$fn__5494.invoke(server.clj:175) at clojure.core$binding_conveyor_fn$fn__4676.invoke(core.clj:1938) at clojure.lang.AFn.run(AFn.java:22) at java.lang.Thread.run(Unknown Source)

How can I make it work?

Serge Intern
  • 2,669
  • 3
  • 22
  • 39

1 Answers1

0

Don't use directly the cljs.jar file, use Leiningen with a minimal template like mies, you have to install Leiningen first, download this script for windows and run it.

Then use:

lein new mies myapp

This will create a ClojureScript project with all the necessary scripts.

Open the core.cljs file and uncomment these lines:

(defonce conn
  (repl/connect "http://localhost:9000/repl"))

To run the browser repl (executing inside the myapp folder).

scripts\brepl.bat

This will compile and run the browser repl, when the process is complete connect Google Chrome to localhost:9000, then the repl should go online.

When you feel sure enough, for a more advanced approach check figwheel, which gives you advanced features, like autobuild and hotswapping.

Check also my other answer about the differences between cljsbuild and figwheel.

Community
  • 1
  • 1
Marcs
  • 3,768
  • 5
  • 33
  • 42