【问题标题】:How can I get the Scala .js 1.3.0 tutorial to run - part 2?如何让 Scala .js 1.3.0 教程运行 - 第 2 部分?
【发布时间】:2021-01-31 05:31:19
【问题描述】:

将项目移动到我在 C 上的本地文件系统后:现在我得到了

sbt:Scala.js Tutorial> run
[warn] There may be incompatibilities among your library dependencies; run 'evicted' to see detailed eviction warnings.
[info] Compiling 1 Scala source to C:\Users\ERIC\Documents\git\scalajs-tutorial\target\scala-2.13\classes ...
[info] Fast optimizing C:\Users\ERIC\Documents\git\scalajs-tutorial\target\scala-2.13\scala-js-tutorial-fastopt
[info] Running tutorial.webapp.TutorialApp. Hit any key to interrupt.
internal/modules/cjs/loader.js:834
  throw err;
  ^

Error: Cannot find module 'jsdom'
Require stack:
- C:\Users\ERIC\Documents\git\scalajs-tutorial\[stdin]
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:831:15)
    at Function.Module._load (internal/modules/cjs/loader.js:687:27)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at codeWithJSDOMContext.js:3:15
    at codeWithJSDOMContext.js:52:3
    at Script.runInThisContext (vm.js:120:18)
    at Object.runInThisContext (vm.js:309:38)
    at [stdin]:2:29
    at Script.runInThisContext (vm.js:120:18) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ 'C:\\Users\\ERIC\\Documents\\git\\scalajs-tutorial\\[stdin]' ]
}
[error] org.scalajs.jsenv.ExternalJSRun$NonZeroExitException: exited with code 1
[error]         at org.scalajs.jsenv.ExternalJSRun$$anon$1.run(ExternalJSRun.scala:186)
[error] stack trace is suppressed; run last Compile / run for the full output
[error] (Compile / run) org.scalajs.jsenv.ExternalJSRun$NonZeroExitException: exited with code 1
[error] Total time: 6 s, completed Oct. 16, 2020, 9:53:33 a.m.

还有

sbt:Scala.js Tutorial> evicted
[warn] Found version conflict(s) in library dependencies; some are suspected to be binary incompatible:
[warn]  * org.scala-js:scalajs-library_2.13:1.3.0 is selected over 1.0.0
[warn]      +- scala-js-tutorial:scala-js-tutorial_sjs1_2.13:0.1.0-SNAPSHOT (depends on 1.3.0)
[warn]      +- org.scala-js:scalajs-dom_sjs1_2.13:1.1.0           (depends on 1.0.0)
[success] Total time: 0 s, completed Oct. 16, 2020, 10:18:13 a.m.

Scala.js 1.3.0 是否已通过 (https://github.com/scala-js/scalajs-tutorial) 上的教程进行测试 还没有?

【问题讨论】:

    标签: scala.js


    【解决方案1】:

    它有点被埋没了,但是从 repo 链接的tutorial 提到你需要单独安装 jsdom:

    这将使用 jsdom 库在 Node.js 中模拟 DOM。请注意,您需要使用

    单独安装它
    $ npm install jsdom
    

    重新加载后即可调用run成功

    【讨论】:

    • 谢谢,这解决了问题...我希望人们将所有依赖项放在前面,而不是像那样埋葬它们。
    • @EricKolotyluk Coolio,我们已经更新了教程,现在提前提到了 jsdom
    猜你喜欢
    • 2021-01-31
    • 2016-06-23
    • 1970-01-01
    • 1970-01-01
    • 2014-04-06
    • 1970-01-01
    • 2015-10-10
    • 2012-11-30
    • 2018-11-13
    相关资源
    最近更新 更多