Runtime exception when trying to dump assetic for Symfony2 project using Windows 7
Asked Answered
A

2

7

I am using Windows platform (please do not laugh at me). And I am trying to build a Symfony2 project using asseti in my localmachine that is running Windows 7.

Now I can not for the love of my life figure out why it is not dumping the assetic files. It is always saying some kind of RunTime Exception. I think it has to do with the coffee bin and node path. Is this the right way to set paths for coffee bin and node?

framework:
    [...]


# Twig Configuration
twig:
    [...]

# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: true
    bundles: [...]


    filters:
        sass:
            load_paths: [ "%kernel.root_dir%/../src/xxxxx/WebsiteBundle/Resources/public/vendor/" ]
            compass: true
        coffee:
            bin: C:\Users\xxxxx\AppData\Roaming\npm\coffee
            node: C:\Program Files\nodejs\node
        cssrewrite: ~


# Doctrine Configuration
[...]

php composer.phar install works fine

php app/console asset:install works fine

php app/console assetic:dump gives me the following error:

[RuntimeException]

Unable to write file C:/xampp/htdocs/xxxxx/app/../web/js/3b27a3f_js?key=AIzaSyCk9Cxgv09X9DKar1bcsLAXxlqP3YhF0OI_1.js

My initial feeling is that something wrong with the coffee bin and node path.

Below is where those are in my machine.

enter image description here

enter image description here

I have no idea what's going on. I'll dump you any output that might help solve this. I feel clueless here. I am using SASS, Compass, coffee, etc.

Aleph answered 2/2, 2015 at 0:15 Comment(4)
I think my colleague had the similar issue recently, try to run cmd as administrator (I don't have windows)Must
I have been running these as administrator in windows. No effect.Aleph
Can you please copy paste the error message to replace the image? The error comes when Symfony2 tries to create the .../3b27a3f_js?key=AIzaSyC... file, that's not a valid filename.Decibel
Add -v option (--verbose) to the dump command. It will show stack trace.Ivied
S
4

integration of Symfony2 and Assetic

1. file config.yml

# Assetic Configuration
assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ ]
    #java: /usr/bin/java
    filters:
        cssrewrite: ~
    less: 
        node: "C:\\Program Files (x86)\\nodejs\\node.exe"
        node_paths: ["C:\\Users\\websky\\AppData\\Roaming\\npm\\node_modules"] 
        apply_to:   "\.less$"
    yui_css: 
        jar: %kernel.root_dir%/../java/yuicompressor-2.4.6.jar 
    yui_js: 
        jar: %kernel.root_dir%/../java/yuicompressor-2.4.6.jar 
        #closure:
        #    jar: "%kernel.root_dir%/Resources/java/compiler.jar"

2. file base.html.twig

    <head> 
        {% stylesheets filter='less,?yui_css' '@AcmeBundle/Resources/less/main.less' %} 
        <link href="{{ asset_url }}" rel="stylesheet" media="screen" /> 
        {% endstylesheets %} 
    </head> 

3. building assetic

php app/console assetic:dump --env=prod

useful link: Less Windows Node.js Hanging

Solicitous answered 10/2, 2015 at 9:25 Comment(0)
C
0

try this

coffee:
   bin: "C:\\Users\\xxxxx\\AppData\\Roaming\\npm\\coffee"
   node: "C:\\Program Files\\nodejs\\node"

I had exactly the same problem with node. If this doesnt work, try pointing to the exact .exe path. Windows seems to have all sorts of trouble.

Good luck

Commutable answered 2/2, 2015 at 9:7 Comment(1)
` coffee: bin: "C:\\Users\\bhatt_000\\AppData\\Roaming\\coffee.cmd" node: "C:\\Ruby193\\node\\node.exe"` I tried this. It did not work. Same errorAleph

© 2022 - 2024 — McMap. All rights reserved.