错误启动“SBT”项目目录内(error starting 'sbt' inside

2019-10-20 17:09发布

我正在学习使用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

Answer 1:

尝试删除本地常春藤目录〜/ .ivy2 /,你可能有一些破罐子这里。 还检查与SBT和Scala环境变量。 你可以检查它是否是你的项目的问题或没有运行SBT SBT项目之外,如果依然出现,比它的SBT安装或环境问题



文章来源: error starting 'sbt' inside project directory
标签: scala sbt