尝试使用 Windows 7 为 Symfony2 项目转储资产时出现运行时异常
Runtime exception when trying to dump assetic for Symfony2 project using Windows 7
我正在使用Windows平台(请不要笑话我)。我正在尝试在我的 运行 Windows 7.
本地机器上使用 asseti 构建一个 Symfony2 项目
现在我无法理解为什么它不转储资产文件。它总是说某种运行时异常。我认为这与咖啡桶和节点路径有关。这是为咖啡桶和节点设置路径的正确方法吗?
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
我的初步感觉是coffee bin和节点路径有问题。
下面是这些在我的机器中的位置。
我不知道发生了什么。我会转储任何可能有助于解决此问题的输出。我在这里感到无能为力。我正在使用 SASS、指南针、咖啡等
试试这个
coffee:
bin: "C:\Users\xxxxx\AppData\Roaming\npm\coffee"
node: "C:\Program Files\nodejs\node"
我在 node.js 上遇到了完全相同的问题。如果这不起作用,请尝试指向确切的 .exe 路径。 Windows好像遇到了各种麻烦
祝你好运
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.建筑资产
php app/console assetic:dump --env=prod
有用link:
Less Windows Node.js Hanging
我正在使用Windows平台(请不要笑话我)。我正在尝试在我的 运行 Windows 7.
本地机器上使用 asseti 构建一个 Symfony2 项目现在我无法理解为什么它不转储资产文件。它总是说某种运行时异常。我认为这与咖啡桶和节点路径有关。这是为咖啡桶和节点设置路径的正确方法吗?
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
我的初步感觉是coffee bin和节点路径有问题。
下面是这些在我的机器中的位置。
我不知道发生了什么。我会转储任何可能有助于解决此问题的输出。我在这里感到无能为力。我正在使用 SASS、指南针、咖啡等
试试这个
coffee:
bin: "C:\Users\xxxxx\AppData\Roaming\npm\coffee"
node: "C:\Program Files\nodejs\node"
我在 node.js 上遇到了完全相同的问题。如果这不起作用,请尝试指向确切的 .exe 路径。 Windows好像遇到了各种麻烦
祝你好运
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.建筑资产
php app/console assetic:dump --env=prod
有用link: Less Windows Node.js Hanging