Michael Bigot
Michael Bigot

Reputation: 1

Assetic:dump error Assetic\Filter\LessFilter

I am working in Windows and trying to deplay my project in prod on Debian server. I am using svn. I changed my config.yml to handle the path of node and less.

When I try to do :php app/console assetic:dump --env=prod on the server I receive an Error : PHP Catchable fatal error: Argument 2 passed to Assetic\Filter\LessFilter::__construct() must be of the type array, string given, called in /var/www/ales/app/cache/prod/appProdProjectContainer.php on line 549 and defined in /var/www/ales/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessFilter.php on line 54

Herewith my configuration :

assetic:
debug:          "%kernel.debug%"
use_controller: false
bundles:        ['MyAppliCoreBundle']
java: /usr/bin/java
filters:
    cssrewrite: ~
    cssembed:
        jar: %kernel.root_dir%/resources/java/cssembed-0.4.5.jar
    less:
        node: /usr/lib/nodejs
        node_paths: [/usr/lib/node_modules]
        apply_to: "\.less$"
    cssrewrite: ~
    yui_css:
        jar: "%kernel.root_dir%/ressources/java/yuicompressor-2.4.8.jar"
assets:
    bootstrap_css:
        inputs:
            - %kernel.root_dir%/../vendor/twbs/bootstrap/less/bootstrap.less
        filters:
            - less
            - cssrewrite
    jquery:
        inputs:
            - %kernel.root_dir%/../vendor/jquery/jquery/jquery-2.1.1.js
        output: js/jquery.js

When I try on DEV I get this error :

22:45:00 [file+] /var/www/ales/app/../web/assetic/bootstrap_css.less
[Assetic\Exception\FilterException]
An error occurred while running:
'/usr/lib/nodejs' '/tmp/assetic_lessBjeLzE'
Error Output:
sh: 1: /usr/lib/nodejs: Permission denied
Input:
// Core variables and mixins
@import "variables.less";
@import "mixins.less";

I checked permission and set to 777 /usr/lib/nodejs but nothing change.

If you need more details, don't hesitate.

Symfony2 with bootstrap 3 on debian.

which node return :

/usr/local/bin/node

wich nodejs return :

/usr/bin/nodejs

and echo $NODE_PATH return :

/usr/lib/nodejs:/usr/lib/node_modules:/usr/share/javascript

Thanks a lot for your help, I was planning to set in prod this weekend...

Upvotes: 0

Views: 1053

Answers (1)

Rober Martin
Rober Martin

Reputation: 31

I had the same problem and solved it well, first you can try with this configuration:

less:
            node: "node"
            node_paths:
                - "/usr/lib/node_modules"
                - "%kernel.root_dir%/../../../node_modules"

if later you have this Error: Cannot find module 'less' you have to install the module:

npm install -g less

I hope I have been helpful!!

Upvotes: 3

Related Questions