请在 2024年 Clojure 状态调查! 中分享您的想法。

欢迎!请查看关于页面以获得更多关于如何使用本站的信息。

+1
ClojureScript

刚刚浏览了(链接:https://script.clojure.org/guides/quick-start TEXT:快速入门)并在“生产构建”部分遇到了错误。
看起来它目前无法使用 :optimizations 编译

`
在主线程 "main" 中抛出异常 java.nio.file.InvalidPathException: 非法字符 <:> 在索引 2 处:/C:/prj/out/cljs/core.js, compiling:(C:\prj\release.clj:3:1)

    at clojure.lang.Compiler.load(Compiler.java:7391)
    at clojure.lang.Compiler.loadFile(Compiler.java:7317)
    at clojure.main$load_script.invokeStatic(main.clj:275)
    at clojure.main$script_opt.invokeStatic(main.clj:335)
    at clojure.main$script_opt.invoke(main.clj:330)
    at clojure.main$main.invokeStatic(main.clj:421)
    at clojure.main$main.doInvoke(main.clj:384)
    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)

原因:java.nio.file.InvalidPathException: 非法字符 <:> 在索引 2 处:/C:/prj/out/cljs/core.js

    at sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
    at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
    at sun.nio.fs.WindowsPathParser.parse(Unknown Source)
    at sun.nio.fs.WindowsPath.parse(Unknown Source)
    at sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
    at com.google.javascript.jscomp.SourceMapResolver.getRelativePath(SourceMapResolver.java:73)
    at com.google.javascript.jscomp.SourceMapResolver.extractSourceMap(SourceMapResolver.java:53)
    at com.google.javascript.jscomp.JsAst.parse(JsAst.java:168)
    at com.google.javascript.jscomp.JsAst.getAstRoot(JsAst.java:55)
    at com.google.javascript.jscomp.CompilerInput.getAstRoot(CompilerInput.java:122)
    at com.google.javascript.jscomp.Compiler.hoistNoCompileFiles(Compiler.java:1992)
    at com.google.javascript.jscomp.Compiler.orderInputs(Compiler.java:1890)
    at com.google.javascript.jscomp.Compiler.parseInputs(Compiler.java:1793)
    at com.google.javascript.jscomp.Compiler.parseForCompilationInternal(Compiler.java:982)
    at com.google.javascript.jscomp.Compiler.access$300(Compiler.java:102)
    at com.google.javascript.jscomp.Compiler$6.call(Compiler.java:964)
    at com.google.javascript.jscomp.Compiler$6.call(Compiler.java:961)
    at com.google.javascript.jscomp.CompilerExecutor$2.call(CompilerExecutor.java:101)
    at java.util.concurrent.FutureTask.run(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

`

5 个答案

0

评论者:mfikes

在当前主分支(1.10.x,1.10.225)1.10.x版本中仍然发生

`
java -cp "cljs.jar;src" cljs.main --optimizations advanced -c hello-world.core
在主线程 "main" 中抛出异常 java.nio.file.InvalidPathException: 非法字符 <:> 在索引 2 处:/C:/Users/mfikes/test_master/hello-world/out/cljs/core.js

    at java.base/sun.nio.fs.WindowsPathParser.normalize(Unknown Source)
    at java.base/sun.nio.fs.WindowsPathParser.parse(Unknown Source)
    at java.base/sun.nio.fs.WindowsPathParser.parse(Unknown Source)
    at java.base/sun.nio.fs.WindowsPath.parse(Unknown Source)
    at java.base/sun.nio.fs.WindowsFileSystem.getPath(Unknown Source)
    at com.google.javascript.jscomp.SourceMapResolver.getRelativePath(SourceMapResolver.java:73)
    at com.google.javascript.jscomp.SourceMapResolver.extractSourceMap(SourceMapResolver.java:53)
    at com.google.javascript.jscomp.JsAst.parse(JsAst.java:168)
    at com.google.javascript.jscomp.JsAst.getAstRoot(JsAst.java:55)
    at com.google.javascript.jscomp.CompilerInput.getAstRoot(CompilerInput.java:134)
    at com.google.javascript.jscomp.Compiler.hoistNoCompileFiles(Compiler.java:2104)
    at com.google.javascript.jscomp.Compiler.orderInputs(Compiler.java:1926)
    at com.google.javascript.jscomp.Compiler.parseInputs(Compiler.java:1828)
    at com.google.javascript.jscomp.Compiler.parseForCompilationInternal(Compiler.java:981)
    at com.google.javascript.jscomp.Compiler.access$300(Compiler.java:101)
    at com.google.javascript.jscomp.Compiler$6.call(Compiler.java:963)
    at com.google.javascript.jscomp.Compiler$6.call(Compiler.java:960)
    at com.google.javascript.jscomp.CompilerExecutor$2.call(CompilerExecutor.java:101)
    at java.base/java.util.concurrent.FutureTask.run(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
    at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

`

0

评论者:mfikes

一个可能的解决方案似乎是在{{:output-dir}}名称中放置一个连字符,例如{{{out-foo}}}。

0
0
参考: https://clojure.atlassian.net/browse/CLJS-2401 (由 alex+import 报告)
0

已编辑

尝试在您的文本编辑器中打开 /hello-world/out/cljs/core.js 目录,然后删除并恢复其中的一些单词。

希望这个回答能解决您的问题。

...