kriswallsmith / assetic

Asset Management for PHP
MIT License
3.75k stars 555 forks source link

Assetic can't read my less files #166

Open ghost opened 12 years ago

ghost commented 12 years ago

I have configured Assetic to read my less files on Symfony2 this way (I'm on OS X):

assetic:
    debug:          %kernel.debug%
    use_controller: false
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
        # closure:
        #     jar: %kernel.root_dir%/java/compiler.jar
        yui_css:
            jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
        yui_js:
            jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar
        less:
            node: /usr/local/bin/node
            node_paths: [/Users/me/node_modules]

I have everything configured, cleared my cache, etc... but when I load my page, styles are gone, and if I try to read the generated code for one of the css files I get this at the beginning of the file:

/*
[exception] 500 | Internal Server Error | RuntimeException
[message] The process stopped because of a "0" signal.
[1] RuntimeException: The process stopped because of a "0" signal.
                at n/a
                    in /Applications/MAMP/htdocs/myapp/vendor/assetic/src/Assetic/Util/Process.php line 195

                at Assetic\Util\Process->run()
                    in /Applications/MAMP/htdocs/myapp/vendor/assetic/src/Assetic/Filter/LessFilter.php line 99

                at Assetic\Filter\LessFilter->filterLoad(object(Assetic\Asset\FileAsset))
                    in /Applications/MAMP/htdocs/myapp/vendor/assetic/src/Assetic/Filter/FilterCollection.php line 62

                at Assetic\Filter\FilterCollection->filterLoad(object(Assetic\Asset\FileAsset))
                    in /Applications/MAMP/htdocs/myapp/vendor/assetic/src/Assetic/Asset/BaseAsset.php line 83

                at Assetic\Asset\BaseAsset->doLoad('/*

So I understand that Assetic (or some of its libs) can't read the files because some character encoding problem. All my source code is in utf8, or at least that is what I think, as I'm forcing that format when saving in Textmate.

Other tools have no problem to convert my less files to css. I'm using the bundled AsseticBundle on the latest Symfony2 (2.0.6).

klvnptr commented 12 years ago

Its probaly some issue with the nodejs compiler. I would test that first alone if thats able to compile less files.

jeremymoore commented 12 years ago

I am receiving the same error in OSX. I'm not sure what direction to go to hunt down an answer, any ideas?

klvnptr commented 12 years ago

still clueless ... what version of sf2 are u using? what version of node and less?

jeremymoore commented 12 years ago

Symfony: 2.0.9 Node: v0.6.9 Less: 1.2.1

Here's the assetic config:

assetic:
    debug:          %kernel.debug%
    use_controller: false
    filters:
        less:
          node: /usr/local/bin/node
          node_paths: [/usr/local/lib/node_modules]
        cssrewrite: ~
        yui_css:
          jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.2.jar
klvnptr commented 12 years ago

yours is even newer than mine. i simply started using command line lessc compiler instead. i have no other solutions yet.

On Monday, January 30, 2012 at 7:04 PM, jeremymoore wrote:

Symfony: 2.0.9 Node: v0.6.9 Less: 1.2.1

Here's the assetic config:

assetic:
debug: %kernel.debug%
use_controller: false
filters:
less:
node: /usr/local/bin/node
node_paths: [/usr/local/lib/node_modules]
cssrewrite: ~
yui_css:
jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.2.jar

--- 
Reply to this email directly or view it on GitHub:
https://github.com/kriswallsmith/assetic/issues/166#issuecomment-3724174
jeremymoore commented 12 years ago

@mcz are you using MAMP?

klvnptr commented 12 years ago

no, i simply changed the built-in apache config. I'm running os x 10.7.2.

are you getting the same error if you run it in a linux environment?

On Monday, January 30, 2012 at 7:29 PM, jeremymoore wrote:

@mcz are you using MAMP?


Reply to this email directly or view it on GitHub: https://github.com/kriswallsmith/assetic/issues/166#issuecomment-3724651

jeremymoore commented 12 years ago

I haven't tried on my remote server yet (which is linux). I debugged through the assetic process.php file to see if I could get more info about the error. I got a bit more detail than what was provided in the on screen exception.

dyld: Symbol not found: __cg_jpeg_resync_to_restart
  Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
  Expected in: /Applications/MAMP/Library/lib/libJPEG.dylib
 in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib

A little googling led me to http://www.princexml.com/bb/viewtopic.php?f=4&t=3204 which while not related to assetic, symfony or less does sound like it could be a similar problem. At least for me. You might see if you can get more details from your php logs or set some breakpoints on line 195 or process.php in the assetic library. check the $this->status variable and it has more details on the error.

klvnptr commented 12 years ago

as far as i can tell its an OS X issue. should be directly related to node.js.

On Monday, January 30, 2012 at 7:35 PM, jeremymoore wrote:

I haven't tried on my remote server yet (which is linux). I debugged through the assetic process.php file to see if I could get more info about the error. I got a bit more detail than what was provided in the on screen exception.

dyld: Symbol not found: __cg_jpeg_resync_to_restart
Referenced from: /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib
Expected in: /Applications/MAMP/Library/lib/libJPEG.dylib
in /System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks/ImageIO.framework/Versions/A/Resources/libTIFF.dylib

A little googling led me to http://www.princexml.com/bb/viewtopic.php?f=4&t=3204 which while not related to assetic, symfony or less does sound like it could be a similar problem. At least for me. You might see if you can get more details from your php logs or set some breakpoints on line 195 or process.php in the assetic library. check the $this->status variable and it has more details on the error.

--- 
Reply to this email directly or view it on GitHub:
https://github.com/kriswallsmith/assetic/issues/166#issuecomment-3724768
jeremymoore commented 12 years ago

Well, maybe you are having a different issue. I actually followed the directions on that post in my previous commend, and commented out the MAMP specific environment variable for $DYLD_LIBRARY_PATH. After a server restart, the less files now compile :)

I would debug if you can and find out if your also receiving that dyld: Symbol not found error. Maybe not since your not running MAMP but maybe osx server does something weird with the same environment variable.

jeremymoore commented 12 years ago

@mcz In fact, i just noticed that on my machine there is a envars-std.in file that contains a fallback library path similar to MAMP. You might checkout /opt/local/apache2/bin/envvars-std.

Try commenting out the 2 lines that are currently setting the library path variable. See if that fixes your problem.

Now all this being said, i'm not sure of the ramifications of removing the library path :)

adambiggs commented 12 years ago

@jeremymoore Thank you!! I was pulling my hair out for 2 hours trying to figure out why Assetic wasn't compiling my CoffeeScript files via use_controller: true, but using php app/console assetic:dump was working fine... Commented out those 2 lines and it's now working!

klvnptr commented 12 years ago

works fine here as well :)

futurepixels commented 12 years ago

Not sure if I am having the same issue as such, but my less files are being parsed when using ./app/console assetic dump --env=dev.

The problem being when I visit /app_dev.php there is no CSS and brings up the same exception 500 as ghost, however, when I visit app.php the css loads and the page renders correctly. I can use the Less CSS app I have installed but I would like to get it working correctly via assetic.

My Config is as follows:

Assetic Configuration
assetic:    
    debug:          %kernel.debug%
    use_controller: false
    bundles:        ['myBundle']
    filters:
        cssrewrite: ~
        less:
            node:       /usr/local/bin/node
            node_paths: [/usr/local/lib/node, /usr/local/lib/node_modules]
        {% stylesheets
                filter='less,cssrewrite' 
               '@myBundle/Resources/public/less/bootstrap.less'
        %}
            <link href="{{ asset_url }}" type="text/css" rel="stylesheet" />
        {% endstylesheets %}
mikebranderhorst commented 12 years ago

@jeremymoore Thanks! Solution for me: https://github.com/kriswallsmith/assetic/issues/166#issuecomment-3724768

nibiru77 commented 12 years ago

Many thanks to Jeremy!!

Commenting that variable in MAMP made me able to move on. Just like Adam, I was losing hours in finding the issue. Thanks! :)

Daandelange commented 11 years ago

@jeremymoore: Thanks, solved my problem too! :) :+1: note: in uncommented the 2 lines in /Applications/MAMP/Library/bin/envvars then restarted mamp

I hope mamp will continue functioning normally xD

rrichter commented 11 years ago

@jeremymoore: Thanks :thumbsup:

ghost commented 11 years ago

@ghost: @jeremymoore : what do you do think should be done about this issue? is it still a problem? should this fix be documented somewhere? I'm ignorant to mamp (and mac in general), but it'd be nice to find a resolution to this issue.

bwhitty commented 10 years ago

@jeremymoore Thank you sir, you are a gentleman and scholar and have saved me from spending another 2 hours on this issue. Cheers. Commented out the envvar variable, restarted MAMP and it now works as expected.

stephanvierkant commented 10 years ago

What's the status of this issue? I think one of our front end designers (Using MAMP on OSX Yosemite) has the same issue. While manually dumping the assets isn't a problem (both using CLI and assetic:dump command in Netbeans), we can't get LESS running in the dev env.

We've commented the 2 lines, but I think that didn't change anything. Is there a way to check if that's really the problem?

/*
[exception] 500 | Internal Server Error | Symfony\Component\Process\Exception\RuntimeException
[message] The process has been signaled with signal &quot;5&quot;.
[1] Symfony\Component\Process\Exception\RuntimeException: The process has been signaled with signal &quot;5&quot;.
    at n/a
        in /Applications/XAMPP/xamppfiles/htdocs/project/vendor/symfony/symfony/src/Symfony/Component/Process/Process.php line 369

    at Symfony\Component\Process\Process-&gt;wait()
        in /Applications/XAMPP/xamppfiles/htdocs/project/vendor/symfony/symfony/src/Symfony/Component/Process/Process.php line 210

    at Symfony\Component\Process\Process-&gt;run()
        in /Applications/XAMPP/xamppfiles/htdocs/project/vendor/kriswallsmith/assetic/src/Assetic/Filter/LessFilter.php line 146

    at Assetic\Filter\LessFilter-&gt;filterLoad(object(FileAsset))
        in /Applications/XAMPP/xamppfiles/htdocs/project/vendor/kriswallsmith/assetic/src/Assetic/Filter/FilterCollection.php line 62

    at Assetic\Filter\FilterCollection-&gt;filterLoad(object(FileAsset))
        in /Applications/XAMPP/xamppfiles/htdocs/project/vendor/kriswallsmith/assetic/src/Assetic/Asset/BaseAsset.php line 94