【问题标题】:Linker error in ScalaJS: "Referring to non-existent class"ScalaJS 中的链接器错误:“引用不存在的类”
【发布时间】:2017-01-27 22:40:43
【问题描述】:

在我刚刚尝试在其中构建 ScalaJS Web 应用程序的 Scala 项目中尝试链接到 FastParse 时遇到一堆链接器错误。

我将 FastParse 的 ScalaJS 依赖项添加到我的 build.sbt 中:这大约是相关行(完整文件 here):

libraryDependencies ++= Seq(
  "com.lihaoyi" %%% "fastparse" % "0.4.1"
)

我的错误很多,但这里有一个有代表性的:

[error] Referring to non-existent class fastparse.Implicits$Repeater$
[error]   called from parsers.MainParser$$anonfun$impls$1.apply()fastparse.core.Parser
[error]   called from parsers.MainParser$$anonfun$impls$1.apply()java.lang.Object
[error]   called from scala.Option.getOrElse(scala.Function0)java.lang.Object
[error]   called from fastparse.StringReprOps$.errorMessage(fastparse.utils.ParserInput,java.lang.String,scala.Int)java.lang.String
[error]   called from fastparse.core.ParseError.<init>(fastparse.core.Parsed$Failure)
[error]   called from fastparse.Api.<init>(scala.reflect.ClassTag,fastparse.utils.ElemSetHelper,fastparse.utils.ReprOps,scala.math.Ordering)
[error]   called from fastparse.StringApi.<init>()
[error]   called from fastparse.all$.<init>()
[error]   called from parsers.MainParser$.<init>()
[error]   called from webapp.WebApp$.makeChoices(java.lang.String,java.lang.String)scala.collection.immutable.List
[error]   called from webapp.WebApp$.$$js$exported$meth$makeChoices(java.lang.String,java.lang.String)java.lang.Object
[error]   called from webapp.WebApp$.makeChoices
[error]   exported to JavaScript with @JSExport
[error] involving instantiated classes:
[error]   parsers.MainParser$$anonfun$impls$1
[error]   scala.None$
[error]   scala.Some
[error]   fastparse.StringReprOps$
[error]   webapp.WebApp$

我做错了什么?

【问题讨论】:

    标签: scala.js


    【解决方案1】:

    问题是我需要在我的build.sbt 中排两行的 JVM 版本的 FastParse。这显然破坏了我的构建。我删除了该行并清理了我的构建,现在项目的 ScalaJS 和 Scala JVM 版本都可以很好地构建。

    (非常感谢李浩毅帮我发现问题)

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-02-06
      • 2017-03-19
      • 2017-05-22
      • 2023-04-10
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多