错误在项目目录中启动'sbt'

时间:2014-08-15 07:47:18

标签: scala sbt

我正在使用Scala学习Coursera的函数式编程。要尝试分配,我需要开始“sbt'在项目目录中。我按照此处的说明操作:https://class.coursera.org/progfun-004/assignment/view?assignment_id=2

这是我得到的错误。我确信项目目录中有build.sbt文件和src文件夹,但不知何故sbt失败了。有什么想法吗?

alex@alex-K46CM:~/progfun-assignments/example  
$ sbt
[info] Loading project definition from /home/alex/progfun-assignments/example/project/project
[info] Loading project definition from /home/alex/progfun-assignments/example/project
[info] Compiling 8 Scala sources to /home/alex/progfun-assignments/example/project/target/scala-2.9.2/sbt-0.12/classes...
[error] error while loading <root>, zip file is empty
scala.tools.nsc.MissingRequirementError: object scala not found.
    at scala.tools.nsc.symtab.Definitions$definitions$.getModuleOrClass(Definitions.scala:655)
    at scala.tools.nsc.symtab.Definitions$definitions$.getModule(Definitions.scala:605)
    at scala.tools.nsc.symtab.Definitions$definitions$.ScalaPackage(Definitions.scala:145)
    at scala.tools.nsc.symtab.Definitions$definitions$.ScalaPackageClass(Definitions.scala:146)
    at scala.tools.nsc.symtab.Definitions$definitions$.AnyClass(Definitions.scala:176)
    at scala.tools.nsc.symtab.Definitions$definitions$.init(Definitions.scala:814)
    at scala.tools.nsc.Global$Run.<init>(Global.scala:697)
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:86)
    at xsbt.CachedCompiler0.liftedTree1$1(CompilerInterface.scala:72)
    at xsbt.CachedCompiler0.run(CompilerInterface.scala:72)
    at xsbt.CompilerInterface.run(CompilerInterface.scala:27)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:606)
    at sbt.compiler.AnalyzingCompiler.call(AnalyzingCompiler.scala:73)
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:35)
    at sbt.compiler.AnalyzingCompiler.compile(AnalyzingCompiler.scala:29)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply$mcV$sp(AggressiveCompile.scala:71)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:71)
    at sbt.compiler.AggressiveCompile$$anonfun$4$$anonfun$compileScala$1$1.apply(AggressiveCompile.scala:71)
    at sbt.compiler.AggressiveCompile.sbt$compiler$AggressiveCompile$$timed(AggressiveCompile.scala:101)
    at sbt.compiler.AggressiveCompile$$anonfun$4.compileScala$1(AggressiveCompile.scala:70)
    at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:88)
    at sbt.compiler.AggressiveCompile$$anonfun$4.apply(AggressiveCompile.scala:60)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:24)
    at sbt.inc.IncrementalCompile$$anonfun$doCompile$1.apply(Compile.scala:22)
    at sbt.inc.Incremental$.cycle(Incremental.scala:52)
    at sbt.inc.Incremental$.compile(Incremental.scala:29)
    at sbt.inc.IncrementalCompile$.apply(Compile.scala:20)
    at sbt.compiler.AggressiveCompile.compile2(AggressiveCompile.scala:96)
    at sbt.compiler.AggressiveCompile.compile1(AggressiveCompile.scala:44)
    at sbt.compiler.AggressiveCompile.apply(AggressiveCompile.scala:31)
    at sbt.Compiler$.apply(Compiler.scala:79)
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:574)
    at sbt.Defaults$$anonfun$compileTask$1.apply(Defaults.scala:574)
    at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
    at sbt.Scoped$$anonfun$hf2$1.apply(Structure.scala:578)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:49)
    at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
    at sbt.Scoped$Reduced$$anonfun$combine$1$$anonfun$apply$12.apply(Structure.scala:311)
    at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:41)
    at sbt.std.Transform$$anon$5.work(System.scala:71)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
    at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:232)
    at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
    at sbt.Execute.work(Execute.scala:238)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
    at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:232)
    at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
    at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
    at java.util.concurrent.FutureTask.run(FutureTask.java:262)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
    at java.lang.Thread.run(Thread.java:744)
[error] (compile:compile) scala.tools.nsc.MissingRequirementError: object scala not found.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore? q

1 个答案:

答案 0 :(得分:3)

尝试删除你当地的常春藤目录〜/ .ivy2 /,你可能在这里有一些破碎的罐子。还要检查与sbt和scala相关的环境变量。您可以通过在sbt项目之外运行sbt来检查是否存在项目问题,如果仍然出现错误,那么它的安装或环境问题