Skip to content
vic

bodil/cljs-noderepl

A ClojureScript REPL running on Node.JS

bodil/cljs-noderepl.json
{
"createdAt": "2012-11-04T18:31:27Z",
"defaultBranch": "master",
"description": "A ClojureScript REPL running on Node.JS",
"fullName": "bodil/cljs-noderepl",
"homepage": null,
"language": "Clojure",
"name": "cljs-noderepl",
"pushedAt": "2014-09-21T13:51:07Z",
"stargazersCount": 168,
"topics": [],
"updatedAt": "2025-05-01T20:39:59Z",
"url": "https://github.com/bodil/cljs-noderepl"
}

Provides a ClojureScript REPL running on Node.JS.

You must have Node version 0.8.x or higher installed.

To setup the Leiningen plugin, add this to your project.clj or ~/.lein/profiles.clj:

:plugins [[org.bodil/lein-noderepl "0.1.11"]]

Then, start the REPL like this:

Terminal window
$ lein trampoline noderepl

Add the following dependency to your project.clj:

[org.bodil/cljs-noderepl "0.1.11"]

To launch the REPL the hard way, run lein repl and enter the following:

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

The REPL is connected to a live Node process running a sandboxed environment, which provides all of Node’s available global variables.

As an example, here’s the standard Node hello world, in REPL ready ClojureScript:

(let [http (js/require "http")
handler (fn [req res] (.end res "Hello sailor!"))
server (.createServer http handler)]
(.listen server 1337))

If you have rlwrap installed, the following provides basic readline and paren matching support:

Terminal window
rlwrap -r -m -q '\"' -b "(){}[],^%3@\";:'" lein trampoline noderepl

You can get cljs-noderepl running on an nREPL server through Piggieback, though it’s a bit fiddly. Here’s how.

Add the cljs-noderepl dependency to your project.clj (it will bring in Piggieback transitively):

[org.bodil/cljs-noderepl "0.1.11"]

You may want to add this dependency to your :dev profile so it’s not carried along when you deploy your library/application.

Then, add the Piggieback nREPL middleware, also in project.clj:

:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}

Now, launch nREPL through Leiningen as usual - lein repl - and connect to it from wherever you prefer. You’ll need to start the ClojureScript REPL manually once you have a Clojure REPL prompt:

user=> (require '[cljs.repl.node :as node])
user=> (node/run-node-nrepl)

Copyright © 2012 Bodil Stokke.

Distributed under the Eclipse Public License, the same as Clojure.