简体   繁体   中英

Error when using assetic:dump in symfony2

I have an error like this when I tried to typing this command php app/console assetic:dump

[Assetic\Exception\FilterException]                                          
An error occurred while running:                                             
'/usr/local/bin/node' '/tmp/assetic_lesswt3ok6'                              

Error Output:                                                                
FileError: '../../bootstrap/less/bootstrap.less' wasn't found.               
 in mopabootstrapbundle.less:22:0                                            
21 // Main bootstrap.less entry point                                        
22 @import "../../bootstrap/less/bootstrap.less";                            
23                                                                           



Input:                                                                       
/*!                                                                          
 * MopaBootstrapBundle                                                       
 *                                                                           
 * Copyright 2011 Mohrenweiser & Partner                                     
 * Licensed under the Apache License v2.0                                    
 * http://www.apache.org/licenses/LICENSE-2.0                                
 *                                                                           
 * Import this file in your less files as first to be abled to access less   
vars from your file                                                          
 * OR                                                                        
 * Add it to the stylesheets of assetic or                                   
 * Add it as described on http://www.lesscss.org with the less.js (maybe pa  
thes must be adapted in that case)                                           
 *                                                                           
 * Be careful when using less this way, might be most straight forward, but  
 assetic doesnt check the included files                                     
 * for changes, and will only regenerate the css if it detects changes in t  
his file!                                                                    
 *                                                                           
 * For development it might be easier to include all you less files in the   
layout directly                                                              
 * But then assetic will compile each less file in a own compiler session s  
o you cant mix in the less style into bootstrap, which might not be OK       
 */                                                                          


// Main bootstrap.less entry point                                           
@import "../../bootstrap/less/bootstrap.less";                               

// variables                                                                 
@iconSpritePath:       "/bundles/mopabootstrap/bootstrap/img/glyphicons-hal  
flings.png";                                                                 
@iconWhiteSpritePath:  "/bundles/mopabootstrap/bootstrap/img/glyphicons-hal  
flings-white.png";                                                           

// The Paginator less for MopaBootstrapBundle                                
@import "paginator.less";                                                    

// The Subnav less for MopaBootstrapBundle                                   
@import "subnav.less";                                                       

// Collection support for MopaBootstrapBundle                                
@import "collections.less";                                                  

// Collection support for MopaBootstrapBundle                                
@import "google-maps.less";                                                  

// if you have any variables.less file INCLUDE IT AFTER EVERYTHING cause re  
sponsive.less also overrides it with the one from bootstrap!!!!!

I don't understand what is the error come from. I tried to search for this error but none of the solutions is work

This is my twig file

{% block stylesheets %}
    {{ parent() }}
    {% stylesheets 
        filter='cssrewrite,?yui_css'
        'bundles/mopabootstrap/css/mopabootstrapbundle.css'
    %}
        <link href="{{ asset_url }}" rel="stylesheet" type="text/css" />
    {% endstylesheets %}
{% endblock %}

I had the same error with mopabootstrap bundle. The command php app/console mopa:bootstrap:symlink:less , used to install symlink, is correctly creating a symlink in vendor/mopa/bootstrap-bundle/Mopa/Bundle/BootstrapBundle/Resources, but the bootstrap.less file is still not found.

So I fixed it by copying the vendor/twbs/bootstrap folder in vendor/mopa/bootstrap-bundle/Mopa/Bundle/BootstrapBundle/Resources. It's not a really proper solution, but at least I can dump the assets.

@Kevin is correct here is the demo solution for what Kevin has given:

php app/console mopa:bootstrap:symlink:less

Initializing composer ... done.

Checking symlink ... not existing

Creating symlink: /var/www/carsing/vendor/mopa/bootstrap-bundle/Mopa/Bundle/BootstrapBundle/Resources/public/bootstrap

for target: ../../../../../../../twbs/bootstrap ... OK

As you can see mopa bundle needs (a link to) bootstrap.

And now php app/console assetic:dump works without error at all.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM