java.lang.NoSuchMethodError:sbt.package $ .Zero()Lsbt / Global $;

时间:2017-09-13 20:39:27

标签: sbt scala.js

使用Scala.js 0.6.20(addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.20")中的project/plugins.sbt)时,尝试使用sbt 0.13.15导入项目时会发生以下错误:

java.lang.NoSuchMethodError: sbt.package$.Zero()Lsbt/Global$;
        at org.scalajs.sbtplugin.ScalaJSPluginInternal$.org$scalajs$sbtplugin$ScalaJSPluginInternal$$scalaJSStageSettings(ScalaJSPluginInternal.scala:254)
        at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$22.apply(ScalaJSPluginInternal.scala:446)
        at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$22.apply(ScalaJSPluginInternal.scala:446)
        at scala.Function2$$anonfun$tupled$1.apply(Function2.scala:54)
        at scala.Function2$$anonfun$tupled$1.apply(Function2.scala:53)

类似问题:https://gitter.im/scala-js/scala-js?at=59b53890b59d55b823db1dcd

2 个答案:

答案 0 :(得分:17)

作为release notes mention,Scala.js 0.6.20要求sbt 0.13.16或更高。为此,应修改project/build.properties文件以设置:

sbt.version=0.13.16

(或兼容的东西)

答案 1 :(得分:1)

替代方法:将scala.js降级为 function onBuy() { const email = firebase.auth().currentUser.email; const ref = firebase.firestore().collection('parties').doc(String(name)).collection('users').doc(String(email)); const ref2 = firebase.firestore().collection('users').doc(String(email)); ref.get() .then((doc) => { if (!doc.exists) { ref2.get() .then((doc2) => { if (doc2.exists) { ref.set({ firstname: doc2.data().firstname, lastname: doc2.data().lastname, phone: doc2.data().phone }).then( ref2.update({ parties: firebase.firestore.FieldValue.arrayUnion(name) }).then( Actions.pop())) .catch(Alert.alert('fail')); } }).catch(Alert.alert('fail')); } else { Alert.alert('this user already bought a ticket'); } }) .catch(Alert.alert('this user already bought a ticket')); } (例如,针对Coursera课程的顶峰)

0.6.19