gpt4 book ai didi

windows - 尝试使用 Windows 7 为 Symfony2 项目转储 Assets 时出现运行时异常

转载 作者:可可西里 更新时间:2023-11-01 13:12:10 25 4
gpt4 key购买 nike

我使用的是Windows平台(请不要笑话我)。我正在尝试在运行 Windows 7 的本地计算机上使用 asseti 构建一个 Symfony2 项目。

现在我无法理解为什么它不转储 Assets 文件。它总是说某种运行时异常。我认为这与咖啡桶和节点路径有关。这是为咖啡桶和节点设置路径的正确方法吗?

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 安装正常

php app/console asset:install 工作正常

php app/console assetic:dump 给我以下错误:

[RuntimeException]

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

我的初步感觉是咖啡桶和节点路径有问题。

下面是它们在我的机器中的位置。

enter image description here

enter image description here

我不知道发生了什么。我会转储任何可能有助于解决此问题的输出。我在这里感到无能为力。我正在使用 SASS、Compass、coffee 等。

最佳答案

Symfony2 与 Assetic 的整合

1.文件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. 文件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. build Assets

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

有用的链接: Less Windows Node.js Hanging

关于windows - 尝试使用 Windows 7 为 Symfony2 项目转储 Assets 时出现运行时异常,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/28269485/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com