【问题标题】:symfony admin bundle installationsymfony 管理包安装
【发布时间】:2018-07-25 08:01:17
【问题描述】:

我正在学习symfony sonata bundle,我用composer create-project symfony/website-skeleton sonata命令安装了symfony骨架项目,我进入sonata目录并运行composer require sonata-project/admin-bundle命令作为symfonydoc上的指南,我检查了所有配置作为医生说,cache:clearassets:install 命令都可以正常工作,我用php bin/console server:start 启动了我的服务器,但是当我访问 url 'http://localhost:8000/admin/dashboard' 时它报告错误,An exception has been thrown during the rendering of a template ("Asset manifest file "/Users/kazuma/www/sonata/public/build/manifest.json" does not exist.").

我之前用 symfony 做过项目,但是我对 webpack 不太了解,我的资产目录是空的,当我运行 npm install 时它也可以正常工作,我不知道我错过了什么。

【问题讨论】:

  • 我打开了我的'public'目录,我只能在它下面找到bundles'directory'和index.php文件,'bundles'目录下有'sonataadmin'和'sonatacore'目录,没有“build”目录或“public”目录下的任何“manifest.json”文件
  • 回答here帮助?
  • @Dragos,是的,第一个答案有效,我将 'assets.yaml' 中的 'assets' 选项设置为 '~',它有效,非常感谢!
  • 运行 yarn install 应该会自动为您执行这些操作。

标签: php symfony webpack symfony-sonata


【解决方案1】:

在 Symfony 4 中

  1. 创建空文件rootProject/public/build/manifest.json
  2. 插入此代码:enter image description here

{
    "bundles": {
        "Sonata\\AdminBundle\\SonataAdminBundle": ["all"]
    },
    "copy-from-recipe": {
        "config/": "%CONFIG_DIR%/",
        "src/": "%SRC_DIR%/"
    }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-01-18
    • 2012-01-18
    • 2018-01-14
    • 1970-01-01
    • 1970-01-01
    • 2016-04-18
    • 2020-12-09
    • 2023-04-05
    相关资源
    最近更新 更多