Dear all,
Proceeding with the ScalaJS basic tutorial:
I faced two issues at steps 5 and 6. Here they are:
-
Step 5: I don’t get any reaction to clicking the button. (For the reference, I am including my Scala file at the P.S. [1].) Everything builds successfully though. Is that the behaviour I should expect?
-
Step 6: After having
jsdom
installed, I still get a type error when tryingrun
in sbt. The error message can again be found in the P.S. [2]. Relevant to that might be the few warnings I get at the end ofjsdom
installation. I am putting those in the P.S. too [3]. Any idea what’s going wrong? (Note that I am performing the installation as the admin. So, there is no authentication issue involved.)
TIA,
–Hossein
P.S.
[1] The Scala file:
package tutorial.webapp
import org.scalajs.jquery.jQuery
object TutorialApp {
def addClickedMessage(): Unit = {
jQuery("body").append("<p>You clicked the button.</p>")
}
def setupUI(): Unit = {
jQuery("#click-me-button").click(() => addClickedMessage())
jQuery("body").append("<p>Hello World!</p>")
}
def main(args: Array[String]): Unit = {
jQuery(() => setupUI())
}
}
[2] The run
error:
> run
[info] Running tutorial.webapp.TutorialApp
[error] module.js:471
[error] throw err;
[error] ^
[error]
[error] Error: Cannot find module ‘jsdom’
[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 [stdin]:39:13
[error] at [stdin]:67:3
[error] at ContextifyScript.Script.runInThisContext (vm.js:25:33)
[error] at Object.runInThisContext (vm.js:97:38)
[error] at Object. ([stdin]-wrapper:6:22)
[error] at Module._compile (module.js:570:32)
org.scalajs.jsenv.ExternalJSEnv$NonZeroExitException: Node.js with JSDOM exited with code 1
at org.scalajs.jsenv.ExternalJSEnv$AbstractExtRunner.waitForVM(ExternalJSEnv.scala:119)
at org.scalajs.jsenv.ExternalJSEnv$ExtRunner.run(ExternalJSEnv.scala:168)
at org.scalajs.sbtplugin.ScalaJSPluginInternal$.org$scalajs$sbtplugin$ScalaJSPluginInternal$$jsRun(ScalaJSPluginInternal.scala:718)
at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$73$$anonfun$apply$50$$anonfun$apply$51.apply(ScalaJSPluginInternal.scala:860)
at org.scalajs.sbtplugin.ScalaJSPluginInternal$$anonfun$73$$anonfun$apply$50$$anonfun$apply$51.apply(ScalaJSPluginInternal.scala:854)
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 with JSDOM exited with code 1
[error] Total time: 2 s, completed 10-Aug-2017 17:53:39
[3] The jsdom
installation warnings:
$npm install jsdom
C:\Windows\system32
`– [email protected]
±- [email protected]
±- [email protected]
±- [email protected]
±- [email protected]
±- [email protected]
±- [email protected]
±- [email protected]
±- [email protected]
| ±- [email protected]
| ±- [email protected]
| ±- [email protected]
| ±- [email protected]
| | ±- [email protected]
| | ±- [email protected]
| | ±- [email protected]
| | ±- [email protected]
| | ±- [email protected]
| |\ -- [email protected] |\
– [email protected]
| `– [email protected]
±- [email protected]
±- [email protected]
±- [email protected]
| `– @types/[email protected]
±- [email protected]
±- [email protected]
| ±- [email protected]
| ±- [email protected]
| ±- [email protected]
| ±- [email protected]
| |\ -- [email protected] | +-- [email protected] | +-- [email protected] | +-- [email protected] | | \
– [email protected]
| ±- [email protected]
| | ±- [email protected]
| | | ±- [email protected]
| | | `– [email protected]
| | | `– [email protected]
| |`– [email protected]
| ±- [email protected]
| | ±- [email protected]
| | ±- [email protected]
| | ±- [email protected]
| | `– [email protected]
| ±- [email protected]
| | ±- [email protected]
| | ±- [email protected]
| | | ±- [email protected]
| | | ±- [email protected]
| | | ±- [email protected]
| | | `– [email protected]
| | | ±- [email protected]
| | | -- [email protected] | | \
– [email protected]
| | ±- [email protected]
| | ±- [email protected]
| | ±- [email protected]
| | ±- [email protected]
| | | `– [email protected]
| | ±- [email protected]
| | ±- [email protected]
| | | `– [email protected]
| | ±- [email protected]
| | `– [email protected]
| ±- [email protected]
| ±- [email protected]
| ±- [email protected]
| ±- [email protected]
| | `– [email protected]
| ±- [email protected]
| ±- [email protected]
| ±- [email protected]
| ±- [email protected]
| ±- [email protected]
| ±- [email protected]
| `– [email protected]
±- [email protected]
| ±- [email protected]
| | `– [email protected]
| `– [email protected]
±- [email protected]
±- [email protected]
±- [email protected]
| `– [email protected]
±- [email protected]
±- [email protected]
| `– [email protected]
±- [email protected]
| ±- [email protected]
| `– [email protected]
`– [email protected]
npm WARN enoent ENOENT: no such file or directory, open ‘C:\Windows\system32\package.json’
npm WARN system32 No description
npm WARN system32 No repository field.
npm WARN system32 No README data
npm WARN system32 No license field.