Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

162
Views
Unable to run scalajs-react project

I'm just trying to set up scalajs-react using official docs, but faced an issue when I tried to run this sbt run:

[info] Fast optimizing C:\temp\scalajs-react\target\scala-2.12\scala-js-tutorial-fastopt.js
[info] Running org.example.TutorialApp
[error] module.js:471
[error]     throw err;
[error]     ^
[error] 
[error] Error: Cannot find module 'react'
[error]     at Function.Module._resolveFilename (module.js:469:15)
[error]     at Function.Module._load (module.js:417:25)
[error]     at Module.require (module.js:497:17)
[error]     at require (internal/module.js:20:19)
[error]     at C:\Users\avkar\AppData\Local\Temp\1484704765073-0\react-dom.js:16:24
[error]     at Object.<anonymous> (C:\Users\avkar\AppData\Local\Temp\1484704765073-0\react-dom.js:40:3)
[error]     at Module._compile (module.js:570:32)
[error]     at Object.Module._extensions..js (module.js:579:10)
[error]     at Module.load (module.js:487:32)
[error]     at tryModuleLoad (module.js:446:12)
org.scalajs.jsenv.ExternalJSEnv$NonZeroExitException: Node.js exited with code 1
    at org.scalajs.jsenv.ExternalJSEnv$AbstractExtRunner.waitForVM(ExternalJSEnv.scala:107)
    at org.scalajs.jsenv.ExternalJSEnv$ExtRunner.run(ExternalJSEnv.scala:156)
    at org.scalajs.sbtplugin.ScalaJSPluginInternal$.org$scalajs$sbtplugin$ScalaJSPluginInternal$$jsRun(ScalaJSPluginInternal.scala:684)
    at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$60$$anonfun$apply$43$$anonfun$apply$44.apply(ScalaJSPluginInternal.scala:771)
    at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$60$$anonfun$apply$43$$anonfun$apply$44.apply(ScalaJSPluginInternal.scala:765)
    at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
[trace] Stack trace suppressed: run 'last compile:run' for the full output.
[error] (compile:run) org.scalajs.jsenv.ExternalJSEnv$NonZeroExitException: Node.js exited with code 1
[error] Total time: 3 s, completed 18.01.2017 8:59:25

I have Node.js on my machine, but there was no 'react' module. So, I decided to install those modules from build.sbt using the command npm install -g react@15.3.2 react-dom@15.3.2

After that, I have the following output for npm list -g --depth=0:

+-- bower@1.8.0
+-- react@15.3.2
`-- react-dom@15.3.2

However, it changes nothing. Still the same error output for sbt run

Does anybody know what's this?

over 4 years ago · Santiago Trujillo
1 answers
Answer question

0

You don't need to install anything into node.js directly. npm install -g react... will have no effect. If you want to run your app using sbt run then it's going to be SBT settings via which you install React.

The scalajs-react docs show how to install React via jsDependencies in SBT. You should still read through the Scala.JS tutorial to find other required settings. I don't use sbt run myself but according to the tutorial you'll probably need to add jsDependencies += RuntimeDOM, run npm install jsdom, and maybe even use skip in packageJSDependencies := false.

If that doesn't work, this is a Scala.JS usage issue, not specific to scalajs-react.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!