Playframework 路由到npm模块失败
我正在尝试Angular2和Play2一起尝试它们。 但我的路线有问题:Playframework 路由到npm模块失败,playframework,npm,Playframework,Npm,我正在尝试Angular2和Play2一起尝试它们。 但我的路线有问题: # Home page GET / controllers.Application.index() # Map static resources from the /public folder to the /assets URL path GET /assets/*file controllers.Assets.at(pat
# Home page
GET / controllers.Application.index()
# Map static resources from the /public folder to the /assets URL path
GET /assets/*file controllers.Assets.at(path="/public", file)
GET /app/*file controllers.Assets.at(path="/public/javascripts", file)
GET /node_modules/*file controllers.Assets.at(path="/node_modules", file)
我得到以下错误:
资源路由不正确,但路径正确。有人知道如何帮助我吗?谢谢您确定在项目根文件夹中有
节点\u模块
文件夹吗
如果是,并且如果它在开发模式activator run
下正常工作,但在生产模式下不工作,则问题在于您没有打包node\u modules
文件夹。您需要将其添加到build.sbt
:
// Add additional folders to the prod
mappings in Universal ++=
(baseDirectory.value / "node_modules" * "*" get) map
(x => x -> ("node_modules/" + x.getName))
是否确实在项目根文件夹中有
节点\u模块
文件夹
如果是,并且如果它在开发模式activator run
下正常工作,但在生产模式下不工作,则问题在于您没有打包node\u modules
文件夹。您需要将其添加到build.sbt
:
// Add additional folders to the prod
mappings in Universal ++=
(baseDirectory.value / "node_modules" * "*" get) map
(x => x -> ("node_modules/" + x.getName))
我发现,为了让Play识别文件夹,它必须位于
public
目录中。无论路径是否正确我发现,为了让Play识别文件夹,它必须位于public
目录中。无论路径是否正确是,文件夹在那里,否,我仍然处于开发模式(在IDE中)。当我删除路由并简单地将文件夹复制到公用文件夹中时,它可以工作,但这不是真正的解决方案编辑:我测试了你添加到build.sbt中的内容,错误仍然是文件夹在那里的sameYes,否,我仍然处于开发模式(在IDE中),当我删除路由并简单地将文件夹复制到公用文件夹中时,它可以工作,但这不是真正的解决方案编辑:我测试了您添加到build.sbt中的内容,错误仍然相同