Search code examples
symfonyyuiassetic

Symfony2 assetic:dump FileNotFoundException


So, there is a problem: i try to build assetic dumps with symfony2 on Windows machine through:

    php app/console assetic:dump

And then i get the following:

    [dir+] D:/Projects/domain/app/../web/js/compiled
    [file+] D:/Projects/domain/app/../web/js/compiled/main.js

    [Assetic\Exception\FilterException]
    An error occurred while running:
    "C:\Program Files\Java\jre7\bin\java.exe" "-jar" "D:/Projects/domain/app/Resources/java/yuicompressor-2.4.8.jar" "--charset" "UTF-8" "-o" "C:\Users\username\AppData\Local\Temp\YUIF039.tmp" "--type" "js" "C:\Users\username\AppData\Local\Temp\YUIF038.tmp"

    Error Output:
    java.io.FileNotFoundException: UsersusernameAppDataLocalTempYUIF039.tmp:\Users\username\AppData\Local\Temp\YUIF038.tmp (the filename,directory name, or volume label syntax is incorrect)

    Input:
    var a = 1;
    alert (a);

Folder "web/js/compiled" is created but stays empty. I can see "in real time" how YUIF03*.tmp files were created and removed during this operation in my TEMP folder. This problem takes place on both Windows machines i've tried, but I have no problems with this on Linux virtual machine. It seems like there is a problem with incorrect file path

    UsersusernameAppDataLocalTempYUIF039.tmp:\Users\username\AppData\Local\Temp\YUIF038.tmp

but i have no idea about the source of the problem (Java? YUICompressor? Symfony2? Assetic?)

Here are some configurations of my symfony2. composer.json:

"require": {
    "php": ">=5.3.3",
    "symfony/symfony": "2.3.*",
    "doctrine/orm": ">=2.2.3,<2.4-dev",
    "doctrine/doctrine-bundle": "1.2.*",
    "twig/extensions": "1.0.*",
    "symfony/assetic-bundle": "2.3.*",
    "symfony/swiftmailer-bundle": "2.3.*",
    "symfony/monolog-bundle": "2.3.*",
    "sensio/distribution-bundle": "2.3.*",
    "sensio/framework-extra-bundle": "2.3.*",
    "sensio/generator-bundle": "2.3.*",
    "incenteev/composer-parameter-handler": "~2.0"
},

config.yml:

    # Assetic Configuration
    assetic:
        debug:          %kernel.debug%
        use_controller: false
        bundles:        [ AcmeWebBundle ]
        java: C:\Program Files\Java\jre7\bin\java.exe
        filters:
            cssrewrite: ~
            yui_js:
                jar: %kernel.root_dir%/Resources/java/yuicompressor-2.4.8.jar

Any ideas?

Thanks!


Solution

  • Same, it is a yui 2.4.8 error : https://github.com/yui/yuicompressor/issues/78

    Just use 2.4.7 : https://github.com/yui/yuicompressor/downloads (the .jar is on the "build" folder).

    java: "C:/Program Files (x86)/Java/jre7/bin/java.exe"
    filters:
        yui_css:
            # 2.4.8 fail on windows
            jar: "%kernel.root_dir%/Resources/java/yuicompressor-2.4.7.jar"