:libs - c:\...\Blocks-Editor\app\js\dependencies\google-blockly\core\blocks.js 不是相对路径

:libs - c:\...\Blocks-Editor\app\js\dependencies\google-blockly\core\blocks.js is not a relative path

抱歉,这一定很愚蠢,但我不知道是什么。

在 REPL 中,(start-figwheel!) 输出:

Figwheel: Starting server at http://0.0.0.0:3449
Figwheel: Watching build - dev
Compiling "app/js/compiled/app.js" from ["src" "dev/cljs/"]...
Failed to compile "app/js/compiled/app.js" in 0.907 seconds.
----  Exception    ----

c:\...\Blocks-Editor\app\js\dependencies\google-blockly\core\blocks.js is not a relative path

----  Exception Stack Trace  ----

java.lang.IllegalArgumentException: c:\Users\u15194\Desktop\Blocks-Editor\app\js\dependencies\google-blockly\core\blocks.js is not a relative path
at clojure.java.io$as_relative_path.invokeStatic (io.clj:414)
clojure.java.io$file.invokeStatic (io.clj:426)
clojure.java.io$file.invoke (io.clj:418)
cljs.closure$write_javascript.invokeStatic (closure.clj:1636)
cljs.closure$write_javascript.invoke (closure.clj:1629)
cljs.closure$source_on_disk.invokeStatic (closure.clj:1675)
cljs.closure$source_on_disk.invoke (closure.clj:1670)
cljs.closure$output_unoptimized$fn__13822.invoke (closure.clj:1713)
clojure.core$map$fn__4785.invoke (core.clj:2646)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.RT.seq (RT.java:521)
clojure.core$seq__4357.invokeStatic (core.clj:137)
clojure.core$filter$fn__4812.invoke (core.clj:2700)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.RT.seq (RT.java:521)
clojure.core$seq__4357.invokeStatic (core.clj:137)
clojure.core$map$fn__4785.invoke (core.clj:2637)
clojure.lang.LazySeq.sval (LazySeq.java:40)
clojure.lang.LazySeq.seq (LazySeq.java:49)
clojure.lang.Cons.next (Cons.java:39)
clojure.lang.RT.next (RT.java:688)
clojure.core$next__4341.invokeStatic (core.clj:64)
clojure.core$str$fn__4419.invoke (core.clj:546)
clojure.core$str.invokeStatic (core.clj:544)
clojure.core$str.doInvoke (core.clj:533)
clojure.lang.RestFn.applyTo (RestFn.java:139)
clojure.core$apply.invokeStatic (core.clj:646)
clojure.core$apply.invoke (core.clj:641)
cljs.closure$deps_file.invokeStatic (closure.clj:1408)
cljs.closure$deps_file.invoke (closure.clj:1405)
cljs.closure$output_deps_file.invokeStatic (closure.clj:1428)
cljs.closure$output_deps_file.invoke (closure.clj:1427)
cljs.closure$output_unoptimized.invokeStatic (closure.clj:1721)
cljs.closure$output_unoptimized.doInvoke (closure.clj:1704)
clojure.lang.RestFn.applyTo (RestFn.java:139)
clojure.core$apply.invokeStatic (core.clj:648)
clojure.core$apply.invoke (core.clj:641)
cljs.closure$build.invokeStatic (closure.clj:2165)
cljs.closure$build.invoke (closure.clj:2055)
cljs.build.api$build.invokeStatic (api.clj:206)
cljs.build.api$build.invoke (api.clj:193)
figwheel_sidecar.components.cljs_autobuild$cljs_build.invokeStatic (cljs_autobuild.clj:28)
figwheel_sidecar.components.cljs_autobuild$cljs_build.invoke (cljs_autobuild.clj:27)
figwheel_sidecar.build_middleware.injection$hook$fn__24627.invoke (injection.clj:197)
figwheel_sidecar.components.cljs_autobuild$notify_command_hook$fn__25008.invoke (cljs_autobuild.clj:68)
figwheel_sidecar.components.cljs_autobuild$figwheel_start_and_end_messages$fn__25000.invoke (cljs_autobuild.clj:48)
figwheel_sidecar.components.cljs_autobuild$catch_print_hook$fn__25040.invoke (cljs_autobuild.clj:185)
figwheel_sidecar.components.cljs_autobuild$open_urls_hook$fn__25032.invoke (cljs_autobuild.clj:141)
figwheel_sidecar.build_middleware.stamp_and_clean$hook$fn__24985.invoke (stamp_and_clean.clj:66)
figwheel_sidecar.components.cljs_autobuild$color_output$fn__25012.invoke (cljs_autobuild.clj:79)
figwheel_sidecar.components.cljs_autobuild.CLJSAutobuild.start (cljs_autobuild.clj:255)
com.stuartsierra.component$eval23404$fn__23405$G__23394__23407.invoke (component.cljc:5)
com.stuartsierra.component$eval23404$fn__23405$G__23393__23410.invoke (component.cljc:5)
clojure.lang.Var.invoke (Var.java:379)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invokeStatic (core.clj:648)
clojure.core$apply.invoke (core.clj:641)
com.stuartsierra.component$try_action.invokeStatic (component.cljc:117)
com.stuartsierra.component$try_action.invoke (component.cljc:116)
com.stuartsierra.component$update_system$fn__23463.invoke (component.cljc:139)
clojure.lang.ArraySeq.reduce (ArraySeq.java:114)
clojure.core$reduce.invokeStatic (core.clj:6544)
clojure.core$reduce.invoke (core.clj:6527)
com.stuartsierra.component$update_system.invokeStatic (component.cljc:135)
com.stuartsierra.component$update_system.doInvoke (component.cljc:129)
clojure.lang.RestFn.invoke (RestFn.java:445)
com.stuartsierra.component$start_system.invokeStatic (component.cljc:163)
com.stuartsierra.component$start_system.invoke (component.cljc:155)
com.stuartsierra.component$start_system.invokeStatic (component.cljc:161)
com.stuartsierra.component$start_system.invoke (component.cljc:155)
com.stuartsierra.component.SystemMap.start (component.cljc:178)
com.stuartsierra.component$eval23404$fn__23405$G__23394__23407.invoke (component.cljc:5)
com.stuartsierra.component$eval23404$fn__23405$G__23393__23410.invoke (component.cljc:5)
clojure.lang.Atom.swap (Atom.java:37)
clojure.core$swap_BANG_.invokeStatic (core.clj:2260)
clojure.core$swap_BANG_.invoke (core.clj:2253)
figwheel_sidecar.system.FigwheelSystem.start (system.clj:118)
com.stuartsierra.component$eval23404$fn__23405$G__23394__23407.invoke (component.cljc:5)
com.stuartsierra.component$eval23404$fn__23405$G__23393__23410.invoke (component.cljc:5)
clojure.lang.Var.invoke (Var.java:379)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.Var.applyTo (Var.java:700)
clojure.core$apply.invokeStatic (core.clj:648)
clojure.core$apply.invoke (core.clj:641)
com.stuartsierra.component$try_action.invokeStatic (component.cljc:117)
com.stuartsierra.component$try_action.invoke (component.cljc:116)
com.stuartsierra.component$update_system$fn__23463.invoke (component.cljc:139)
clojure.lang.ArraySeq.reduce (ArraySeq.java:109)
clojure.core$reduce.invokeStatic (core.clj:6544)
clojure.core$reduce.invoke (core.clj:6527)
com.stuartsierra.component$update_system.invokeStatic (component.cljc:135)
com.stuartsierra.component$update_system.doInvoke (component.cljc:129)
clojure.lang.RestFn.invoke (RestFn.java:445)
com.stuartsierra.component$start_system.invokeStatic (component.cljc:163)
com.stuartsierra.component$start_system.invoke (component.cljc:155)
com.stuartsierra.component$start_system.invokeStatic (component.cljc:161)
com.stuartsierra.component$start_system.invoke (component.cljc:155)
com.stuartsierra.component.SystemMap.start (component.cljc:178)
figwheel_sidecar.system$start_figwheel_system$fn__25248.invoke (system.clj:658)
figwheel_sidecar.system$dispatch_system_component_errors.invokeStatic (system.clj:644)
figwheel_sidecar.system$dispatch_system_component_errors.invoke (system.clj:642)
figwheel_sidecar.system$start_figwheel_system.invokeStatic (system.clj:658)
figwheel_sidecar.system$start_figwheel_system.invoke (system.clj:656)
figwheel_sidecar.system$start_figwheel_BANG__STAR_.invokeStatic (system.clj:693)
figwheel_sidecar.system$start_figwheel_BANG__STAR_.invoke (system.clj:679)
clojure.lang.AFn.applyToHelper (AFn.java:156)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invokeStatic (core.clj:646)
clojure.core$apply.invoke (core.clj:641)
figwheel_sidecar.system$start_figwheel_BANG_.invokeStatic (system.clj:737)
figwheel_sidecar.system$start_figwheel_BANG_.doInvoke (system.clj:695)
clojure.lang.RestFn.invoke (RestFn.java:397)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.RestFn.applyTo (RestFn.java:132)
clojure.core$apply.invokeStatic (core.clj:646)
clojure.core$apply.invoke (core.clj:641)
figwheel_sidecar.repl_api$start_figwheel_BANG_$fn__25265.invoke (repl_api.clj:28)
clojure.lang.AFn.applyToHelper (AFn.java:154)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.lang.Var.alterRoot (Var.java:303)
clojure.core$alter_var_root.invokeStatic (core.clj:5299)
clojure.core$alter_var_root.doInvoke (core.clj:5294)
clojure.lang.RestFn.invoke (RestFn.java:425)
figwheel_sidecar.repl_api$start_figwheel_BANG_.invokeStatic (repl_api.clj:28)
figwheel_sidecar.repl_api$start_figwheel_BANG_.doInvoke (repl_api.clj:25)
clojure.lang.RestFn.invoke (RestFn.java:397)
user$start.invokeStatic (user.clj:4)
user$start.invoke (user.clj:4)
user$eval85181.invokeStatic (form-init157753958820776154.clj:2248)
user$eval85181.invoke (form-init157753958820776154.clj:2248)
clojure.lang.Compiler.eval (Compiler.java:6927)
clojure.lang.Compiler.eval (Compiler.java:6890)
clojure.core$eval.invokeStatic (core.clj:3105)
clojure.core$eval.invoke (core.clj:3101)
clojure.main$repl$read_eval_print__7408$fn__7411.invoke (main.clj:240)
clojure.main$repl$read_eval_print__7408.invoke (main.clj:240)
clojure.main$repl$fn__7417.invoke (main.clj:258)
clojure.main$repl.invokeStatic (main.clj:258)
clojure.main$repl.doInvoke (main.clj:174)
clojure.lang.RestFn.applyTo (RestFn.java:137)
clojure.core$apply.invokeStatic (core.clj:646)
clojure.core$apply.invoke (core.clj:641)
refactor_nrepl.ns.slam.hound.regrow$wrap_clojure_repl$fn__43227.doInvoke (regrow.clj:18)
clojure.lang.RestFn.invoke (RestFn.java:1523)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate$fn__22540.invoke (interruptible_eval.clj:87)
clojure.lang.AFn.applyToHelper (AFn.java:152)
clojure.lang.AFn.applyTo (AFn.java:144)
clojure.core$apply.invokeStatic (core.clj:646)
clojure.core$with_bindings_STAR_.invokeStatic (core.clj:1881)
clojure.core$with_bindings_STAR_.doInvoke (core.clj:1881)
clojure.lang.RestFn.invoke (RestFn.java:425)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invokeStatic (interruptible_eval.clj:85)
clojure.tools.nrepl.middleware.interruptible_eval$evaluate.invoke (interruptible_eval.clj:55)
clojure.tools.nrepl.middleware.interruptible_eval$interruptible_eval$fn__22585$fn__22588.invoke (interruptible_eval.clj:222)
clojure.tools.nrepl.middleware.interruptible_eval$run_next$fn__22580.invoke (interruptible_eval.clj:190)
clojure.lang.AFn.run (AFn.java:22)
java.util.concurrent.ThreadPoolExecutor.runWorker (:-1)
java.util.concurrent.ThreadPoolExecutor$Worker.run (:-1)
java.lang.Thread.run (:-1)

我正在使用 Google Blockly Library,它使用 GCL

怎么了?

这是项目文件树:

app/
  js/
    dependencies/google-blockly/
    compiled/out/
dev/
src/ --> cljs
project.clj

google-块状:

+---accessible
|   +---libs
|   \---media
+---appengine
+---blocks
+---core
+---demos
|   +---accessible
|   +---blockfactory
|   |   \---workspacefactory
|   +---blockfactory_old
|   +---code
|   |   \---msg
|   +---custom-dialogs
|   +---fixed
|   +---generator
|   +---graph
|   +---headless
|   +---interpreter
|   +---maxBlocks
|   +---mirror
|   +---plane
|   |   +---generated
|   |   +---soy
|   |   \---xlf
|   +---resizable
|   +---rtl
|   +---storage
|   \---toolbox
+---generators
|   +---dart
|   +---javascript
|   +---lua
|   +---php
|   \---python
+---i18n
+---media
+---msg
|   +---js
|   \---json
\---tests
    +---blocks
    +---generators
    +---jsunit
    \---workspace_svg

project.clj

(defproject blocks-editor "0.1.0-SNAPSHOT"
  :description "An editor for visual blocks programming built with ClojureScript + Electron" 
  :dependencies [[org.clojure/clojure "1.8.0"]
                 [org.clojure/clojurescript "1.9.473" :exclusions [org.apache.ant/ant]]
                 [re-frame "0.9.2"]]

  :plugins [[lein-cljsbuild "1.1.5"]
            [lein-externs "0.1.6"]
            [lein-shell "0.5.0"]
            [lein-figwheel "0.5.9" :exclusions [org.clojure/core.cache]]]

  :profiles {:dev {:dependencies [[figwheel "0.5.9"]
                                  [figwheel-sidecar "0.5.9"]
                                  [com.cemerick/piggieback "0.2.1"]
                                  [binaryage/devtools "0.9.2"]]

                   :source-paths ["src" "dev"]}}

  :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}

  :hooks [leiningen.cljsbuild] 
  :cljsbuild {:builds
              {:release {:source-paths ["src"]
                         :compiler {:output-to "app/js/compiled/app.js"
                                    :libs ["app/js/dependencies/google-blockly"]
                                    :main blocks-editor.init
                                    :optimizations :advanced}}

               :dev {:source-paths ["src" "dev/cljs/"]
                     :figwheel true
                     :compiler {:output-to "app/js/compiled/app.js"
                                :output-dir "app/js/compiled/out"
                                :main user.cljs
                                :libs ["app/js/dependencies/google-blockly"]

                                :asset-path "js/compiled/out"
                                :source-map-timestamp true
                                :preloads [devtools.preload]
                                :optimizations :none}}}}

  :clean-targets ^{:protect false} ["app/js/compiled"])

我不知道你为什么会收到这个错误,但在我看来,figwheel 或 lein-cljsbuild 正在解释你提供的相对路径,导致错误,并试图将其解释为一个绝对的。这种问题通常很难解决,但我有几点建议:

  1. 换个环境试试运行;如果您使用 cmd,请尝试 git bash, or (even better) Bash for Windows。你可能会发现这解决了路径问题,但显然如果你喜欢你当前的环境就不好了(我建议 Bash 为 Windows 为所有 clojure,注意)。

  2. 尝试打包 google-blockly 在 cljsjs 的罐子里;这有点痛苦,但另一方面你也会帮助其他人!然后你可以像往常一样将它添加为 leiningen 依赖项。对 google 库执行此操作应该比对大多数库更容易,因为困难通常来自为不适用于 google 的闭包编译器的事物创建外部表达式。

  3. 检查你的行结尾和文件编码是否正确,这是一个外部机会,但根据我的经验,有时这会导致与路径相关的问题。

  4. 检查您的 clojurescript 版本,可能有一个 outstanding issue 正在影响您...

祝你好运!