我很绝望。我可以在bin/console assetic:dump
命令的帮助下从Sass生成CSS就好了,它可以在生产中使用。但是,如果我试图通过控制器运行它 - 它会崩溃。
所以,例如:http://zmasakrowani-symfony.localhost/app_dev.php/css/b82eb50_main_1.css
给我这个错误:
/* [exception] 500 | Internal Server Error | Assetic\Exception\FilterException [message] An error occurred while running: '/usr/sbin/ruby' '/home/luken/.gem/ruby/2.3.0/bin/compass' 'compile' '/home/luken/srv/http/projects/2016/zmasakrowani-symfony/var/cache/dev' '--boring' '--config' '/home/luken/srv/http/projects/2016/zmasakrowani-symfony/var/cache/dev/assetic_compassXyzU4Z' '--sass-dir' '' '--css-dir' '' '/home/luken/srv/http/projects/2016/zmasakrowani-symfony/var/cache/dev/assetic_compasse7YLuO.scss'
Error Output: /usr/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'compass' (>= 0.a) among 12 total gem(s) (Gem::LoadError) Checked in 'GEM_PATH=/tmp/.gem/ruby/2.3.0:/usr/lib/ruby/gems/2.3.0', execute `gem env` for more information from /usr/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem' from /home/luken/.gem/ruby/2.3.0/bin/compass:22:in `<main>'
Input: @import "compass";
.articles { height: 20px; background: yellow; color: red; } [1] Assetic\Exception\FilterException: An error occurred while running: '/usr/sbin/ruby' '/home/luken/.gem/ruby/2.3.0/bin/compass' 'compile' '/home/luken/srv/http/projects/2016/zmasakrowani-symfony/var/cache/dev' '--boring' '--config' '/home/luken/srv/http/projects/2016/zmasakrowani-symfony/var/cache/dev/assetic_compassXyzU4Z' '--sass-dir' '' '--css-dir' '' '/home/luken/srv/http/projects/2016/zmasakrowani-symfony/var/cache/dev/assetic_compasse7YLuO.scss'
Error Output: /usr/lib/ruby/2.3.0/rubygems/dependency.rb:319:in `to_specs': Could not find 'compass' (>= 0.a) among 12 total gem(s) (Gem::LoadError) Checked in 'GEM_PATH=/tmp/.gem/ruby/2.3.0:/usr/lib/ruby/gems/2.3.0', execute `gem env` for more information from /usr/lib/ruby/2.3.0/rubygems/dependency.rb:328:in `to_spec' from /usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_gem.rb:65:in `gem' from /home/luken/.gem/ruby/2.3.0/bin/compass:22:in `<main>'
Input: @import "compass";
.articles { height: 20px; background: yellow; color: red; }
at n/a
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/vendor/kriswallsmith/assetic/src/Assetic/Exception/FilterException.php line 40
at Assetic\Exception\FilterException::fromProcess(object(Process))
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/vendor/kriswallsmith/assetic/src/Assetic/Filter/CompassFilter.php line 356
at Assetic\Filter\CompassFilter->filterLoad(object(FileAsset))
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/vendor/kriswallsmith/assetic/src/Assetic/Filter/FilterCollection.php line 62
at Assetic\Filter\FilterCollection->filterLoad(object(FileAsset))
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/vendor/kriswallsmith/assetic/src/Assetic/Asset/BaseAsset.php line 94
at Assetic\Asset\BaseAsset->doLoad('@import "compass";
.articles { height: 20px; background: yellow; color: red; }', null)
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/vendor/kriswallsmith/assetic/src/Assetic/Asset/FileAsset.php line 65
at Assetic\Asset\FileAsset->load()
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/vendor/kriswallsmith/assetic/src/Assetic/Asset/BaseAsset.php line 103
at Assetic\Asset\BaseAsset->dump(object(AssetCacheKeyFilter))
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/vendor/kriswallsmith/assetic/src/Assetic/Asset/AssetCache.php line 69
at Assetic\Asset\AssetCache->dump(object(AssetCacheKeyFilter))
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/vendor/symfony/assetic-bundle/Controller/AsseticController.php line 90
at Symfony\Bundle\AsseticBundle\Controller\AsseticController->render(object(Request), 'b82eb50', '0')
in line
at call_user_func_array(array(object(AsseticController), 'render'), array(object(Request), 'b82eb50', '0'))
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 139
at Symfony\Component\HttpKernel\HttpKernel->handleRaw(object(Request), '1')
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/HttpKernel.php line 62
at Symfony\Component\HttpKernel\HttpKernel->handle(object(Request), '1', true)
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/vendor/symfony/symfony/src/Symfony/Component/HttpKernel/Kernel.php line 169
at Symfony\Component\HttpKernel\Kernel->handle(object(Request))
in /home/luken/srv/http/projects/2016/zmasakrowani-symfony/web/app_dev.php line 30
*/
主要问题在于:
/usr/lib/ruby/site_ruby/2.3.0/rubygems/dependency.rb:308:in `to_specs': Could not find 'compass'
但是我肯定有指南针。它适用于bin / console assetic:dump,为什么它只能在dev环境/资产控制器中工作?
更多数据。我的资产配置:
assetic:
debug: '%kernel.debug%'
use_controller: '%kernel.debug%'
bundles: [AppBundle]
filters:
cssrewrite: ~
compass:
bin: '/home/luken/.gem/ruby/2.3.0/bin/compass'
在我的Twig模板中,在标题中我有这个:
{% stylesheets filter='cssrewrite,compass'
"@AppBundle/Resources/sass/main.scss"
%}
<link rel="stylesheet" href="{{ asset_url }}" />
{% endstylesheets %}
知道可能出现什么问题吗?
添加#1:
同时输出gem env
:
RubyGems Environment:
- RUBYGEMS VERSION: 2.6.3
- RUBY VERSION: 2.3.0 (2015-12-25 patchlevel 0) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib/ruby/gems/2.3.0
- USER INSTALLATION DIRECTORY: /home/luken/.gem/ruby/2.3.0
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- SPEC CACHE DIRECTORY: /home/luken/.gem/specs
- SYSTEM CONFIGURATION DIRECTORY: /etc
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib/ruby/gems/2.3.0
- /home/luken/.gem/ruby/2.3.0
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- "gem" => "--user-install"
- REMOTE SOURCES:
- https://rubygems.org/
- SHELL PATH:
- /home/luken/bin
- /home/luken/.gem/ruby/2.3.0/bin
- /home/luken/.composer/vendor/bin
- /usr/local/sbin
- /usr/local/bin
- /usr/bin
- /usr/lib/jvm/default/bin
- /usr/bin/site_perl
- /usr/bin/vendor_perl
- /usr/bin/core_perl
已添加#2:
另一个值得注意的事情:Apache进程由我的用户拥有。