问题描述
我正在尝试遵循
我已经按照快速入门指南中的说明下载了Clojurescript jar。我已经验证它具有适当的大小(大约19M)。我已经创建了文件。但是当我尝试使用以下命令进行构建时:
I have downloaded the Clojurescript jar as described in the Quick-Start guide. I have verified that it has the appropriate size (about 19M). I have created the files. But when I try to build using the command:
java -cp cljs.jar:src clojure.main build.clj
Java返回以下堆栈跟踪:
Java returns the following stacktrace:
Exception in thread "main" java.io.FileNotFoundException: Could not locate cls/build/api__init.class or cls/build/api.clj on classpath., compiling:(/Users/jnedzel/Documents/prj/closurescript/quickstart/hello_world/build.clj:1:1)
at clojure.lang.Compiler.load(Compiler.java:7249)
at clojure.lang.Compiler.loadFile(Compiler.java:7175)
at clojure.main$load_script.invoke(main.clj:275)
at clojure.main$script_opt.invoke(main.clj:337)
at clojure.main$main.doInvoke(main.clj:421)
at clojure.lang.RestFn.invoke(RestFn.java:408)
at clojure.lang.Var.invoke(Var.java:379)
at clojure.lang.AFn.applyToHelper(AFn.java:154)
at clojure.lang.Var.applyTo(Var.java:700)
at clojure.main.main(main.java:37)
Caused by: java.io.FileNotFoundException: Could not locate cls/build/api__init.class or cls/build/api.clj on classpath.
有什么想法吗?
推荐答案
TL; DR : build.clj
从快速入门开始,文件 build.clj 应具有以下内容:
As of the Quick-Start, the file build.clj should have the following content:
(require 'cljs.build.api)
(cljs.build.api/build "src" {:output-to "out/main.js"})
错误消息显示无法找到cls / build /api__init.class
。当clojure编译器编译ns时,将生成名为 my / domain / lib__init.class 的加载程序类文件。在给定(需要'my.domain.lib)
的情况下,将加载该类。
The error message says Could not locate cls/build/api__init.class
. When the clojure compiler compiles a ns, a loader classfile is generated with the name my/domain/lib__init.class. That's the class that will be loaded given (require 'my.domain.lib)
.
cljs.build.api
,即为 cljs /build/api__init.class 。但是它正尝试加载 cls /build/api__init.class ,因此您在这里有错字。
In the case of cljs.build.api
, that would be cljs/build/api__init.class. But it is trying to load cls/build/api__init.class instead, so you have a typo there.
这篇关于Clojurescript快速入门问题-构建失败的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!