Skip to content
swannodette edited this page Jan 4, 2015 · 10 revisions

As of 0.0-2655 REPLs have changed significantly enough that many existing third party REPLs and REPL launchers no longer work. While they are likely to be updated in the near future the following demonstrates how to run REPLs directly without using anything more than Leiningen itself.

All that is required is to make a REPL runner .clj file. For example if your cljsbuild entry looks like the following:

{:id "dev"
 :source-paths ["src"]
 :compiler {
   :output-to "hello_world.js"
   :output-dir "out"
   :optimizations :none
   :cache-analysis true                
   :source-map true}}

Then your node_repl.clj file should look like the following:

(require
  '[cljs.repl :as repl]
  '[cljs.repl.node :as node])

(repl/repl* (node/repl-env)
  {:output-dir "out"
   :optimizations :none
   :cache-analysis true                
   :source-map true})

You can then run the Node.js REPL against your build with the following:

lein trampoline run -m clojure.main node_repl.clj

For better behavior at the command line installed rlwrap (under OS X easily done with brew), then:

rlwrap lein trampoline run -m clojure.main node_repl.clj
Clone this wiki locally