javascript - 将 npm 中的 js 库添加为 Play 2.0 应用程序的依赖项

标签 javascript playframework npm sbt webjars

我正在尝试将react-grid-layout添加到我的play 2.0网络应用程序中。首先,我找到了这个库的 web jar 并将其添加到 build.sbt 中。所以我的 sbt 如下所示:

libraryDependencies ++= Seq(
  jdbc,
  cache,
  ws,
  specs2 % Test,
  "org.webjars" %% "webjars-play" % "2.4.0-1",
  "org.webjars" % "react" % "0.14.0",
  "org.webjars" % "marked" % "0.3.2",
  "org.webjars" % "jquery" % "2.1.4",
  "org.webjars.npm" % "react-grid-layout" % "0.9.1"
  )

在我有的路线

GET     /webjars/*file              controllers.WebJarAssets.at(file)

除了react-grid-layout之外的所有库都已成功安装到target/web/web-modules目录中。所以,我猜问题出在 npm org.webjars.npm 上。

我应该怎么做才能正确安装每个js库?

最佳答案

詹姆斯在下面解释了它 github issue .

Deployment is manual for all libraries and their dependencies. But this is something that anyone can do with NPM & Bower WebJars. I think a good / easy first step with this is to present a list of missing transitive dependencies when a deployment finishes. That would make it easy for someone to walk through the tree to manually deploy everything.

他后来补充道:

It is possible that the WebJar you are trying to use is failing because of missing transitive dependencies. This usually happens when libraries are missing required metadata so they can't be imported into Maven Central. It is an unfortunate situation but there isn't much we can do to fix it. The alternative is to use Classic WebJars instead. Info on creating Classic WebJars: http://www.webjars.org/contributing

查看上面链接的完整 github 问题以获取完整对话。

关于javascript - 将 npm 中的 js 库添加为 Play 2.0 应用程序的依赖项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35042864/

相关文章:

javascript - $(...).tooltip 无法工作,因为 jQuery 1.9.2 由于旧的 jQuery UI 1.8.16 库而无法工作?如何解决这个问题?

javascript - SignalR 客户端应用程序在 VS2008 中运行时无法连接

javascript - 以编程方式将使用发送到不同的端点

playframework - Play run 和 start 之间有什么区别?

java - Play Framework 在所有其他作业之后运行作业

javascript - 将参数从 cmd 行传递到 package.json

javascript - 从选择中获取范围内的源代码片段?

ssh - Play框架2.3.x,无需控制台即可运行

node.js - node-gyp 针对错误的 NODE_MODULE_VERSION 进行编译

javascript - 创建了 package.json 文件,但在运行 npm install 时出现依赖项错误