sjrd / scalajs-sbt-vite-laminar-chartjs-example

An example of using Scala.js with sbt, Vite, Laminar and Chart.js
Apache License 2.0
89 stars 18 forks source link

npm run dev causes 'sbt process failed with exit code 1' #2

Open pme123 opened 1 year ago

pme123 commented 1 year ago

Hi When trying the example step by step - I get the following exception running npm run dev:

failed to load config from /Users/mpa/dev/experiments/scalajs-sbt-vite-laminar-chartjs-example/vite.config.js
error when starting dev server:
Error: sbt process failed with exit code 1
    at printSbtTask (file:///Users/mpa/dev/experiments/scalajs-sbt-vite-laminar-chartjs-example/vite.config.js.timestamp-1670515518441.mjs:20:11)
    at file:///Users/mpa/dev/experiments/scalajs-sbt-vite-laminar-chartjs-example/vite.config.js.timestamp-1670515518441.mjs:24:21
    at ModuleJob.run (internal/modules/esm/module_job.js:152:23)
    at async Loader.import (internal/modules/esm/loader.js:166:24)
    at async loadConfigFromBundledFile (file:///Users/mpa/dev/experiments/scalajs-sbt-vite-laminar-chartjs-example/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:62827:21)
    at async loadConfigFromFile (file:///Users/mpa/dev/experiments/scalajs-sbt-vite-laminar-chartjs-example/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:62712:28)
    at async resolveConfig (file:///Users/mpa/dev/experiments/scalajs-sbt-vite-laminar-chartjs-example/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:62336:28)
    at async createServer (file:///Users/mpa/dev/experiments/scalajs-sbt-vite-laminar-chartjs-example/node_modules/vite/dist/node/chunks/dep-51c4f80a.js:61636:20)
    at async CAC.<anonymous> (file:///Users/mpa/dev/experiments/scalajs-sbt-vite-laminar-chartjs-example/node_modules/vite/dist/node/cli.js:707:24)

After trying some stuff, here is what worked for me (Mac OS):

image
FloWi commented 1 year ago

I can't get it to run on mac. sbt --error doesn't start and always crashes with this exception. Haven't found a way to suppress the verbose sbt welcome message :(.

java.lang.RuntimeException: Session not initialized.
    at scala.sys.package$.error(package.scala:30)
    at sbt.Project$.$anonfun$getOrError$1(Project.scala:450)
    at scala.Option.getOrElse(Option.scala:189)
    at sbt.Project$.getOrError(Project.scala:450)
    at sbt.Project$.session(Project.scala:456)
    at sbt.Project$.extract(Project.scala:461)
    at sbt.BuiltinCommands$.$anonfun$setParser$1(Main.scala:667)
    at sbt.Command$.$anonfun$applyEffect$3(Command.scala:150)
    at sbt.Command$.$anonfun$argParser$1(Command.scala:171)
    at sbt.Command$.$anonfun$simpleParser$3(Command.scala:182)
    at sbt.internal.util.complete.BindParser.derive(Parser.scala:757)
    at sbt.internal.util.complete.MatchedString.derive(Parser.scala:795)
    at sbt.internal.util.complete.And.derive(Parser.scala:825)
    at sbt.internal.util.complete.HomParser.derive(Parser.scala:706)
    at sbt.internal.util.complete.MapParser.derive(Parser.scala:770)
    at sbt.internal.util.complete.And.derive(Parser.scala:825)
    at sbt.internal.util.complete.SeqParser.derive(Parser.scala:693)
    at sbt.internal.util.complete.BindParser.derive(Parser.scala:755)
    at sbt.internal.util.complete.MapParser.derive(Parser.scala:770)
    at sbt.internal.util.complete.HomParser.derive(Parser.scala:706)
    at sbt.internal.util.complete.ParserMain.derive1(Parser.scala:496)
    at sbt.internal.util.complete.ParserMain.derive1$(Parser.scala:495)
    at sbt.internal.util.complete.Parser$.derive1(Parser.scala:138)
    at sbt.internal.util.complete.ParserMain.$anonfun$apply$1(Parser.scala:492)
    at sbt.internal.util.complete.ParserMain.$anonfun$apply$1$adapted(Parser.scala:492)
    at scala.collection.IndexedSeqOptimized.foldLeft(IndexedSeqOptimized.scala:60)
    at scala.collection.IndexedSeqOptimized.foldLeft$(IndexedSeqOptimized.scala:68)
    at scala.collection.immutable.StringOps.foldLeft(StringOps.scala:33)
    at sbt.internal.util.complete.ParserMain.apply(Parser.scala:492)
    at sbt.internal.util.complete.ParserMain.apply$(Parser.scala:491)
    at sbt.internal.util.complete.Parser$.apply(Parser.scala:138)
    at sbt.BasicCommands$.aliasBody(BasicCommands.scala:544)
    at sbt.BasicCommands$.$anonfun$newAlias$1(BasicCommands.scala:538)
    at sbt.Command$.$anonfun$argParser$1(Command.scala:171)
    at sbt.Command$.$anonfun$simpleParser$3(Command.scala:182)
    at sbt.internal.util.complete.BindParser.derive(Parser.scala:757)
    at sbt.internal.util.complete.HomParser.derive(Parser.scala:706)
    at sbt.internal.util.complete.ParserMain.loop$1(Parser.scala:485)
    at sbt.internal.util.complete.ParserMain.result(Parser.scala:487)
    at sbt.internal.util.complete.ParserMain.result$(Parser.scala:473)
    at sbt.internal.util.complete.Parser$.result(Parser.scala:138)
    at sbt.internal.util.complete.ParserMain.parse(Parser.scala:436)
    at sbt.internal.util.complete.ParserMain.parse$(Parser.scala:435)
    at sbt.internal.util.complete.DefaultParsers$.parse(Parsers.scala:345)
    at sbt.Command$.process(Command.scala:188)
    at sbt.MainLoop$.$anonfun$processCommand$5(MainLoop.scala:245)
    at scala.Option.getOrElse(Option.scala:189)
    at sbt.MainLoop$.process$1(MainLoop.scala:245)
    at sbt.MainLoop$.processCommand(MainLoop.scala:278)
    at sbt.MainLoop$.$anonfun$next$5(MainLoop.scala:163)
    at sbt.State$StateOpsImpl$.runCmd$1(State.scala:289)
    at sbt.State$StateOpsImpl$.process$extension(State.scala:325)
    at sbt.MainLoop$.$anonfun$next$4(MainLoop.scala:163)
    at sbt.internal.util.ErrorHandling$.wideConvert(ErrorHandling.scala:23)
    at sbt.MainLoop$.next(MainLoop.scala:163)
    at sbt.MainLoop$.run(MainLoop.scala:144)
    at sbt.MainLoop$.$anonfun$runWithNewLog$1(MainLoop.scala:119)
    at sbt.io.Using.apply(Using.scala:27)
    at sbt.MainLoop$.runWithNewLog(MainLoop.scala:112)
    at sbt.MainLoop$.runAndClearLast(MainLoop.scala:66)
    at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:51)
    at sbt.MainLoop$.runLogged(MainLoop.scala:42)
    at sbt.StandardMain$.runManaged(Main.scala:215)
    at sbt.xMain$.$anonfun$run$11(Main.scala:133)
    at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
    at scala.Console$.withIn(Console.scala:230)
    at sbt.internal.util.Terminal$.withIn(Terminal.scala:569)
    at sbt.internal.util.Terminal$.$anonfun$withStreams$1(Terminal.scala:350)
    at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
    at scala.Console$.withOut(Console.scala:167)
    at sbt.internal.util.Terminal$.$anonfun$withOut$2(Terminal.scala:559)
    at scala.util.DynamicVariable.withValue(DynamicVariable.scala:62)
    at scala.Console$.withErr(Console.scala:196)
    at sbt.internal.util.Terminal$.withOut(Terminal.scala:559)
    at sbt.internal.util.Terminal$.withStreams(Terminal.scala:350)
    at sbt.xMain$.withStreams$1(Main.scala:87)
    at sbt.xMain$.run(Main.scala:121)
    at java.base/jdk.internal.reflect.DirectMethodHandleAccessor.invoke(DirectMethodHandleAccessor.java:104)
    at java.base/java.lang.reflect.Method.invoke(Method.java:577)
    at sbt.internal.XMainConfiguration.run(XMainConfiguration.java:57)
    at sbt.xMain.run(Main.scala:46)
    at xsbt.boot.Launch$.$anonfun$run$1(Launch.scala:149)
    at xsbt.boot.Launch$.withContextLoader(Launch.scala:176)
    at xsbt.boot.Launch$.run(Launch.scala:149)
    at xsbt.boot.Launch$.$anonfun$apply$1(Launch.scala:44)
    at xsbt.boot.Launch$.launch(Launch.scala:159)
    at xsbt.boot.Launch$.apply(Launch.scala:44)
    at xsbt.boot.Launch$.apply(Launch.scala:21)
    at xsbt.boot.Boot$.runImpl(Boot.scala:78)
    at xsbt.boot.Boot$.run(Boot.scala:73)
    at xsbt.boot.Boot$.main(Boot.scala:21)
    at xsbt.boot.Boot.main(Boot.scala)
FloWi commented 1 year ago

TIL: check your ~/.sbtrc. We defined plenty of aliases there and also had this one:

alias err = set maxErrors := 

This caused sbt --error to crash in weird ways. Got a clue in this gist where someone mentioned this file.

Created an issue for sbt, maybe someone has an idea on how to provide better error reporting. https://github.com/sbt/sbt/issues/7092