【问题标题】:Error [Assetic\Exception\FilterException] Symfony Assetic with Less Css错误 [Assetic\Exception\FilterException] Symfony Assetic with Less Css
【发布时间】:2013-01-14 21:03:47
【问题描述】:

我正在尝试配置 symfony 资产管理器来编译我的 less css 文件并重写路径但是我收到以下错误:

Dumping all dev assets.
Debug mode is on.
18:51:01 [file+] C:/htdocs/site-ideiah-symfony/app/../web/css/57b3454.css
[Assetic\Exception\FilterException]
An error occurred while running:
"C:\Users\Rafael\AppData\Local\Temp\ass1C74.tmp"

Error Output:
Access Denied

我的 config.yml

filters:
    cssrewrite: 
        apply_to: '\.(css|less)$'
    less: 
        node: [ "C:\\Program Files\\nodejs\\node.exe" ]      
        node_paths: [ "C:\\Program Files\\nodejs\\", "C:\\Program Files\\nodejs\\node_modules\\" ]
        apply_to: "\.less$"

我的模板用法

  {% block stylesheets %}
        {% stylesheets filter='less,cssrewrite'
            '@IdeiahSiteAppBundle/Resources/public/less/style.less'
        %}
        <link href="{{ asset_url }}" type="text/css" rel="stylesheet" media="all" />
        {% endstylesheets %}
    {% endblock %}

我正在使用带有 PHP 5.4.7 的 Windows 8,有谁知道我该如何修复它?

【问题讨论】:

    标签: symfony less assetic


    【解决方案1】:

    Error Output: Access Denied 消息暗示这是一个安全相关问题。

    此安全问题可能与 1) 无法写入输出文件、2) 无法读取输入文件和/或 3) 无法执行 node 命令

    1) 运行assetic:dump 命令的用户是否能够写入文件夹C:/htdocs/site-ideiah-symfony/web/css/57b3454.css 文件?

    2)在Error Output:之后,assetic也应该显示使用的输入,类似这样:

    Input:
    /*!
     * Bootstrap v2.3.1
     *
     * Copyright 2012 Twitter, Inc
     * Licensed under the Apache License v2.0
     * http://www.apache.org/licenses/LICENSE-2.0
     *
     * Designed and built with all the love in the world @twitter by @mdo and @fat
     */
    
    // Core variables and mixins
    @import "variables.less"; // Modify this for custom colors, font-sizes, etc
    @import "mixins.less";
    
    // CSS Reset
    @import "reset.less";
    

    是否看到列出的任何输入?

    3) 检查用户是否从命令行执行"C:\Program Files\nodejs\node.exe"

    【讨论】:

      【解决方案2】:

      我遇到了类似的问题。删除 Less 并安装旧版本为我修复了它。其他解决方案之一似乎是将 symfony 升级到新版本,但我们无法这样做,因为必须使用与 centos6.5 兼容的旧版本 symfony

      这有帮助:https://github.com/braincrafted/bootstrap-bundle/issues/217

      【讨论】:

        猜你喜欢
        • 2013-02-19
        • 2014-08-06
        • 2016-11-08
        • 2013-11-12
        • 2013-05-15
        • 1970-01-01
        • 2017-10-25
        • 2015-03-06
        • 2014-06-20
        相关资源
        最近更新 更多