我按照Quick-Start尝试Nodejs repl
$ cat node_repl.clj
(require 'cljs.repl)
(require 'cljs.build.api)
(require 'cljs.repl.node)
(cljs.build.api/build "src"
{:main 'hello-world.core
:output-to "out/main.js"
:verbose true})
(cljs.repl/repl (cljs.repl.node/repl-env)
:watch "src"
:output-dir "out")
$ cat src/hello_world/core.cljs
(ns hello-world.core
(:require [clojure.nodejs :as nodejs]))
(nodejs/enable-util-print!)
(defn -main [& args]
(println "Hello world! 123"))
(set! *main-cli-fn* -main)
当我运行rlwrap java -cp cljs.jar:src clojure.main node_repl.clj
时,我收到了此错误:
$ rlwrap java -cp cljs.jar:src clojure.main node_repl.clj
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/cljs/core.cljs to out/cljs/core.cljs
Reading analysis cache for jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/cljs/core.cljs
Compiling out/cljs/core.cljs
Using cached cljs.core out/cljs/core.cljs
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/cljs/nodejs.cljs to out/cljs/nodejs.cljs
Compiling out/cljs/nodejs.cljs
Compiling src/hello_world/core.cljs
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/goog/base.js to out/goog/base.js
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/goog/string/string.js to out/goog/string/string.js
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/goog/object/object.js to out/goog/object/object.js
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/goog/math/integer.js to out/goog/math/integer.js
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/goog/string/stringbuffer.js to out/goog/string/stringbuffer.js
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/goog/debug/error.js to out/goog/debug/error.js
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/goog/dom/nodetype.js to out/goog/dom/nodetype.js
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/goog/asserts/asserts.js to out/goog/asserts/asserts.js
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/goog/array/array.js to out/goog/array/array.js
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/goog/reflect/reflect.js to out/goog/reflect/reflect.js
Copying jar:file:/Users/liujiacai/codes/clojure/cls/cljs.jar!/goog/math/long.js to out/goog/math/long.js
Copying file:/Users/liujiacai/codes/clojure/cls/src/hello_world/core.cljs to out/hello_world/core.cljs
ClojureScript Node.js REPL server listening on 55283
java.lang.IllegalArgumentException: Value out of range for char: -1
at clojure.lang.RT.charCast(RT.java:1052)
at cljs.repl.node$read_response.invokeStatic(node.clj:49)
at cljs.repl.node$setup.invokeStatic(node.clj:133)
at cljs.repl.node.NodeEnv._setup(node.clj:192)
at cljs.repl$repl_STAR_$fn__5113.invoke(repl.cljc:884)
at cljs.compiler$with_core_cljs.invokeStatic(compiler.cljc:1154)
at cljs.repl$repl_STAR_.invokeStatic(repl.cljc:871)
at cljs.repl$repl.invokeStatic(repl.cljc:1037)
我缺少什么?