我试图建立一个项目,使用重新帧和电子的结合,我很想安装重新框架-10 x,这样我就可以很容易地观看应用程序db的某些部分。我以前使用过一个常规的clojurescript/重新框架项目,通过谷歌铬访问,但还没有使用电子。我很有希望,因为我相信电子使用的代码基本上与引擎盖下的铬相同。
我遵循了重新框架-10x github页面上的设置说明,一切似乎都很好。但是,我无法调用10x窗口。
这是我的project.clj文件的一部分,特别是clojurescript构建:
:cljsbuild
{:builds
{:dev-main {:source-paths ["src"]
:incremental true
:jar true
:assert true
:compiler {:output-to "app/dev/js/cljsbuild-main.js"
:externs ["app/dev/js/externs.js"
"node_modules/closurecompiler-externs/path.js"
"node_modules/closurecompiler-externs/process.js"]
:warnings true
:elide-asserts true
:target :nodejs
:output-dir "app/dev/js/out_main"
:optimizations :simple
:pretty-print true
:output-wrapper true
:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}
:preloads [day8.re-frame-10x.preload]
:main "anh.core" }}
:dev-front {:source-paths ["src_front" "src_front_profile/anh_front/dev"]
:incremental true
:jar true
:assert true
:compiler {:output-to "app/dev/js/front.js"
:externs ["app/dev/js/externs_front.js"]
:warnings true
:elide-asserts true
:optimizations :none
:output-dir "app/dev/js/out_front"
:pretty-print true
:output-wrapper true }}请注意,有两个构建。(图-状态)告诉我,它正在监视和重新编译开发前沿。dev-main包含指向重新帧-10 x所需的main的指针。
Clojurescript已经升级到最新的版本"1.10.64“,一切看起来都很好,没有出现错误信息,比如repl启动(使用emacs中的jack-in ),或者当clojurescript repl启动时。
仍然没有任何迹象表明,重新框架-10倍窗口。当我点击应用程序窗口中的ctrl时,应该会出现这种情况。
在这条线下面是我在路上试过的东西。可能与此无关。
在cljs repl的启动过程中,我看到它在reFrag-10x中遇到了一些问题:
user> Figwheel: Starting server at http://0.0.0.0:3441
Figwheel: Watching build - dev-front
Figwheel: Cleaning build - dev-front
Compiling "app/dev/js/front.js" from ["src_front" "src_front_profile/anh_front/dev"]...
Failed to compile "app/dev/js/front.js" in 10.853 seconds.
---- Could not Analyze app/dev/js/out_front/day8/re_frame_10x/subs.cljs ----
No such namespace: cljs.spec.alpha, could not locate cljs/spec/alpha.cljs, cljs/spec/alpha.cljc, or Closure namespace "cljs.spec.alpha"
---- Analysis Error : Please see app/dev/js/out_front/day8/re_frame_10x/subs.cljs ----
Launching ClojureScript REPL for build: dev-front知道这意味着什么吗?我还没有使用cljs.spec (目前为止),但是编译器似乎正在寻找它。
这是project.clj文件的一个部分,其中包含了reFrame-10x所要求的修改,特别是在相关cljsbuild部分的编译器部分中的闭包定义、预加载和到main的链接:
:dev-front {:source-paths ["src_front" "src_front_profile/anh_front/dev"]
:incremental true
:jar true
:assert true
:compiler {:output-to "app/dev/js/front.js"
:externs ["app/dev/js/externs_front.js"]
:warnings true
:elide-asserts true
:optimizations :none
:output-dir "app/dev/js/out_front"
:pretty-print true
:output-wrapper true
:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}
:preloads [day8.re-frame-10x.preload]
:main "anh.core"
}}更新:
这起到了帮助:没有这样的命名空间:在clojurescript项目设置中的clojure.spec.alpha按照建议,我将clojurescript升级到最新版本,其中包含所需的规范内容,当cljs启动时,repl显示了一个不同的错误:
Failed to load resource: net::ERR_FILE_NOT_FOUND
cljs_deps.js Failed to load resource: net::ERR_FILE_NOT_FOUND
base.js:677 goog.require could not find: day8.re_frame_10x.preload
goog.logToConsole_ @ base.js:677
base.js:711 Uncaught Error: goog.require could not find: day8.re_frame_10x.preload
at Object.goog.require (base.js:711)
at index.html:11
base.js:677 goog.require could not find: anh.core
goog.logToConsole_ @ base.js:677
base.js:711 Uncaught Error: goog.require could not find: anh.core
at Object.goog.require (base.js:711)
at index.html:11
base.js:677 goog.require could not find: anh_front.init
goog.logToConsole_ @ base.js:677
base.js:711 Uncaught Error: goog.require could not find: anh_front.init
at Object.goog.require (base.js:711)
at index.html:12这只是找不到的主要功能。project.clj文件指定了2 dev生成、dev-前台和dev-main。我在错误的部分使用了clojurescript编译器选项。将它们移到正确的部分可以消除错误,但是当我点击ctrl时,reFrame-10x窗口仍然不会出现。
发布于 2018-03-09 03:09:36
解决这个问题的关键是把它放在正确的构造中。德斯乔普有2个开发版本,一个用于应用程序本身( dev -main),另一个用于窗口(开发前沿)。Dev-main可以,而且很可能应该单独呆着。这些变化需要在开发前端的构建中进行。
第一步
将开发前端构建转换为:优化无。这是重新帧-10 x的要求之一。要做到这一点,需要将以下内容添加到profile.clj的cljsbuild部分:dev-前台:编译器部分:
:main "setup-front.init"
:asset-path "js/out_front"然后,可以将html文件简化为"setup-front.init“将为您加载所需的内容。就像这样:
<body>
<div id="app">
<p>Minimum app does not work.</p>
</div>
<script type="text/javascript" src="js/front.js" charset="utf-8"></script>
</body>第二步
升级!默认情况下,Descjop使用的是一个旧版本的clojurescript,它不提供一些重新框架-10 x使用的功能。org.clojure/clojurescript "1.10.64“对我有用。
在此之后,可以遵循重帧-10x指令,并且它应该可以正常工作。简而言之,将以下内容添加到放置:main语句的cljsbuild部分中
:closure-defines {"re_frame.trace.trace_enabled_QMARK_" true}
:preloads [day8.re-frame-10x.preload]并将其添加到依赖项中。最好进入:概要文件:dev部分。不过,请查看说明或闭锁以获得最新版本:
[day8.re-frame/re-frame-10x "0.2.1-SNAPSHOT"]使用这些更改的一个非常基本的hello世界的源代码可以在github上获得。
感谢迈克·卡拉汉提出的解决方案的要点。
https://stackoverflow.com/questions/49035176
复制相似问题