Search code examples
sbtscala.jsscalably-typed

SBT: error: not found: value npmDependencies npmDependencies in Compile ++= Seq(...)


I try to start a project with [ScalablyTyped][1].

When starting sbt I get the following exception:

error: not found: value npmDependencies

npmDependencies in Compile ++= Seq("d3" -> "5.5.0")

Here is my plugin.sbt:

resolvers += Resolver.bintrayRepo("oyvindberg", "ScalablyTyped")
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.26")
addSbtPlugin("org.scalablytyped" % "sbt-scalablytyped" % "201904160530")

and my Builod.sbt:

enablePlugins(ScalaJSPlugin)

name := "Scala.js Tutorial"
scalaVersion := "2.12.6" 
resolvers += Resolver.bintrayRepo("oyvindberg", "ScalablyTyped")
libraryDependencies ++= Seq(ScalablyTyped.D.d3)
npmDependencies in Compile ++= Seq("d3" -> "5.5.0")

Solution

  • npmDependencies is a key provided by scalajs-bundler, so you'll need the following line in your project/plugins.sbt:

    addSbtPlugin("ch.epfl.scala" % "sbt-scalajs-bundler" % "0.14.0")
    

    and in build.sbt

    enablePlugins(ScalaJSBundlerPlugin)