[英]Clojurescript quickstart issue with leiningen
I follow the Clojurescript QuickStart on Window 7 and stuck with the final point - run with Leiningen. 我遵循Window 7上的Clojurescript QuickStart ,并坚持了最后一点-与Leiningen一起运行。
Simple command: 简单命令:
lein run -m clojure.main repl.clj
returns error with enomourous stacktrace wich starts so: 返回错误,堆栈跟踪开始,所以:
clojure.lang.Compiler$CompilerException: java.io.FileNotFoundException: Could not locate cljs/repl__init.class or cljs/repl.clj on classpath: , compiling:(X:\n\code\hello_world\repl.clj:1:1)
I've search the web and found nearest case , but I've just copied whole code from the site, so I believe there is no typo. 我已经在网上搜索并找到了最接近的大小写 ,但是我只是从网站上复制了整个代码,所以我相信没有错字。
What am I missing? 我想念什么?
repl.clj: repl.clj:
(require 'cljs.repl)
(require 'cljs.build.api)
(require 'cljs.repl.browser)
(cljs.build.api/build "src"
{:main 'hello-world.core
:output-to "out/main.js"
:browser-repl true
:verbose true})
(cljs.repl/repl (cljs.repl.browser/repl-env)
:watch "src"
:output-dir "out")
Update: I've created project 'hw' with lein, copied repl.clj to the project root directory as well as cljs.jar. 更新:我用lein创建了项目“ hw”,将repl.clj复制到了项目根目录以及cljs.jar。 Also I've copied cljs.jar to src directory (it was mentioned in the quick start guide that src goes to classpath automatically), but result is the same.
另外,我已经将cljs.jar复制到src目录(快速入门指南中提到src自动进入类路径),但是结果是相同的。
project.clj: project.clj:
(defproject hw "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]]
:main ^:skip-aot hw.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
Update 2 更新2
Also no luck even with adding clojurescript as dependency: 即使添加clojurescript作为依赖项也没有运气:
(defproject hw "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
:license {:name "Eclipse Public License"
:url "http://www.eclipse.org/legal/epl-v10.html"}
:dependencies [[org.clojure/clojure "1.6.0"]
[org.clojure/clojurescript "1.7.170"]
]
:main ^:skip-aot hw.core
:target-path "target/%s"
:profiles {:uberjar {:aot :all}})
Putting cljs.jar to lib direcroty didn't help either. 将cljs.jar放入lib direcroty也没有帮助。
https://youtu.be/ciCQ_Nkis4I https://youtu.be/ciCQ_Nkis4I
For Leiningen to pick up cljs.jar
you need to create a lib
directory off your project root directory and put cljs.jar
in there.为了让Leiningen拿起 The tutorial does mention this under the Dependencies section, which comes just before the Leiningen section: cljs.jar
您需要在项目根目录下创建一个lib
目录,并将cljs.jar
放在其中。本教程确实在“依赖关系”部分中提到了这一点,该部分位于“ Leiningen”部分之前:
If you have a few dependencies, one convention is to put them into a folder called lib
如果您有一些依赖项,则一种惯例是将它们放入名为lib的文件夹中
I guess you are supposed to infer that Leiningen follows this convention. 我想您应该推断出莱宁根遵循了这一惯例。
My evidence for this working is here: leiningen - how to add dependencies for local jars? 我的工作证据在这里: leiningen-如何为本地jar添加依赖项?
However notice there's a comment at the bottom: 但是请注意,底部有一个注释:
As of Leiningen v2, the lib/ directory functionality has been removed.
从Leiningen v2开始,lib /目录功能已被删除。
So the Quickstart tutorial is out of date. 因此,快速入门教程已过时。
I would recommend going straight to figwheel for an introduction to Clojurescript, despite what is said there. 我建议您直接去figwheel上介绍Clojurescript,尽管那里有这么说。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.