Getting "Internal error: Scala instance does not exist or is invalid" when trying to start a worksheet in IntelliJ IDEA

I am trying to install Scala for a Coursera course on Ubuntu, and I followed their instructions by installing open-jdk 1.8, sbt (sbt about says v1.0.2) and IntelliJ Idea. I created an sbt project with a HelloWorld Scala worksheet in src / main / scala that just says “Hello world”, but when I try to evaluate the worksheet, I get an error

Internal error: Scala instance does not exist or is invalid: version is unknown, library jar: / home / [my username] /. ivy2 / cache / jline / jline / jars / jline-2.14.5.jar, the jar compiler: / home / [my username] /. ivy2 / cache / org.scala-lang.modules / scala -xml_2.12 / bundles / scala -xml_2.12-1.0.6.jar

followed by a longer track. Is there any tuning method that I skip? The project seems to point to Java v1.8 in the project structure dependencies, and on the Libraries tab, I see that SBT is installed on Scala v2.12.

+5
source share
2 answers

I just had the same issue with macOS Sierra. I decided by noticing that in my build.sbt I had:

name := "myScalaTests"
version := "0.1"
scalaVersion := "2.12.4"

but when prompted sbt about, my version for Scala was different.

sbt about
[warn] No sbt.version set in project/build.properties, base directory: /Users/myUser/projects
[info] Set current project to projects (in build file:/Users/myUser/projects/)
[info] This is sbt 1.0.2
[info] The current project is {file:/Users/myUser/projects/}projects 0.1-SNAPSHOT
[info] The current project is built against Scala 2.12.3
[info] Available Plugins: sbt.plugins.IvyPlugin, sbt.plugins.JvmPlugin, sbt.plugins.CorePlugin, sbt.plugins.JUnitXmlReportPlugin, sbt.plugins.Giter8TemplatePlugin
[info] sbt, sbt plugins, and build definitions are using Scala 2.12.3

so I changed the scala version in build.sbt accordingly and it worked.

+7
source

The same internal error can be caused by a version mismatch between the sbt launcher and the sbt version of the project, as described here:

Internal error: Scala instance does not exist or is invalid

Scala, sbt .

0

Source: https://habr.com/ru/post/1687987/


All Articles