Closed cap10morgan closed 9 years ago
Hi! CIDER can only interact with REPLs that use the nREPL protocol, which the CLJS REPL does not out-of-the-box. Fortunately you can use piggieback to accomplish this, the current snapshot version of which supports the new node.js REPL.
[com.cemerick/piggieback "0.1.5-SNAPSHOT"]
to your project's dependencies.cider-jack-in
(or C-c M-j
).repl
script in David's blog post, but using piggieback):(require '[cljs.repl.node :as node]
'[cemerick.piggieback :as piggieback])
(piggieback/cljs-repl :repl-env (node/repl-env)
:output-dir "out"
:optimizations :none
:cache-analysis true
:source-map true)
CIDER will now use the running CLJS REPL to power its autocompletion, documentation/source lookup, etc.
@bbatsov once piggieback 0.1.5 is released I'll open a PR to update the documentation accordingly.
@cichli I think piggieback 0.1.5 was released about a month ago. :-)
In other exciting news - it seems that after the recent cljs changes we might not need piggieback soon.
Hi Folks, I tried your solution with this config (I create a cljs project with https://github.com/swannodette/mies-node-template) and only added piggieback requirements
(defproject hello-world "0.1.0-SNAPSHOT"
:description "FIXME: write this!"
:url "http://example.com/FIXME"
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/clojurescript "0.0-2755"]
[com.cemerick/piggieback "0.1.5-SNAPSHOT"]]
:node-dependencies [[source-map-support "0.2.8"]]
:plugins [[lein-cljsbuild "1.0.4"]
[lein-npm "0.4.0"]]
:source-paths ["src" "target/classes"]
:clean-targets ["out" "out-adv"]
:repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}
:cljsbuild {
:builds [{:id "dev"
:source-paths ["src"]
:compiler {
:main hello-world.core
:output-to "out/hello_world.js"
:output-dir "out"
:optimizations :none
:cache-analysis true
:source-map true}}
{:id "release"
:source-paths ["src"]
:compiler {
:main hello-world.core
:output-to "out-adv/hello_world.min.js"
:output-dir "out-adv"
:optimizations :advanced
:pretty-print false}}]})
But I get "No such file or directory"
2. Unhandled java.io.IOException
Cannot run program "node": error=2, No such file or directory
ProcessBuilder.java: 1048 java.lang.ProcessBuilder/start
node.clj: 88 cljs.repl.node/setup
node.clj: 160 cljs.repl.node.NodeEnv/_setup
repl.clj: 93 cljs.repl/eval4412/fn/G
repl.clj: 93 cljs.repl/eval4412/fn/G
piggieback.clj: 196 cemerick.piggieback/cljs-repl/fn
piggieback.clj: 194 cemerick.piggieback/cljs-repl
RestFn.java: 805 clojure.lang.RestFn/invoke
REPL: 4 user/eval7138
Compiler.java: 6703 clojure.lang.Compiler/eval
Compiler.java: 6666 clojure.lang.Compiler/eval
core.clj: 2927 clojure.core/eval
main.clj: 239 clojure.main/repl/read-eval-print/fn
main.clj: 239 clojure.main/repl/read-eval-print
main.clj: 257 clojure.main/repl/fn
main.clj: 257 clojure.main/repl
RestFn.java: 1523 clojure.lang.RestFn/invoke
interruptible_eval.clj: 67 clojure.tools.nrepl.middleware.interruptible-eval/evaluate/fn
AFn.java: 152 clojure.lang.AFn/applyToHelper
AFn.java: 144 clojure.lang.AFn/applyTo
core.clj: 624 clojure.core/apply
core.clj: 1862 clojure.core/with-bindings*
RestFn.java: 425 clojure.lang.RestFn/invoke
interruptible_eval.clj: 51 clojure.tools.nrepl.middleware.interruptible-eval/evaluate
interruptible_eval.clj: 183 clojure.tools.nrepl.middleware.interruptible-eval/interruptible-eval/fn/fn
interruptible_eval.clj: 152 clojure.tools.nrepl.middleware.interruptible-eval/run-next/fn
AFn.java: 22 clojure.lang.AFn/run
ThreadPoolExecutor.java: 1142 java.util.concurrent.ThreadPoolExecutor/runWorker
ThreadPoolExecutor.java: 617 java.util.concurrent.ThreadPoolExecutor$Worker/run
Thread.java: 745 java.lang.Thread/run
1. Caused by java.io.IOException
error=2, No such file or directory
UNIXProcess.java: -2 java.lang.UNIXProcess/forkAndExec
UNIXProcess.java: 185 java.lang.UNIXProcess/<init>
ProcessImpl.java: 134 java.lang.ProcessImpl/start
ProcessBuilder.java: 1029 java.lang.ProcessBuilder/start
node.clj: 88 cljs.repl.node/setup
node.clj: 160 cljs.repl.node.NodeEnv/_setup
repl.clj: 93 cljs.repl/eval4412/fn/G
repl.clj: 93 cljs.repl/eval4412/fn/G
piggieback.clj: 196 cemerick.piggieback/cljs-repl/fn
piggieback.clj: 194 cemerick.piggieback/cljs-repl
RestFn.java: 805 clojure.lang.RestFn/invoke
REPL: 4 user/eval7138
@tangrammer do you have node installed? :-)
@cichli this works fine now, right? The repl should be on the nrepl
protocol by now.
ClojureScript 0.0-2665 has a new Node.js-based REPL that would be great to use with CIDER. Here's a good starting point for the new REPL.
Currently CIDER tries to connect to it, but it clearly isn't compatible.