Install less and Configure on Symfony 2 on Ubuntu 12.04

This also can fix the following errors when parsing a less file with node:
- Error: Cannot find module ‘less’
- TypeError: Cannot call method ‘charAt’ of undefined

First you need to install npm (https://npmjs.org/ Package manager for node)

sudo apt-get install npm

Install less (latest version)

sudo npm install --global less

Now configure your app/config.yml

..
assetic:
    ...
    filters:
        ...
        less:
            ...
            node_paths: [/usr/local/lib/node_modules] (or /usr/lib/node_modules)

Leave a Comment

NOTE - You can use these HTML tags and attributes:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>