2012-08-01 39 views
1

我試圖使用Capifony,它需要Capistrano,它需要Ruby。但我的紅寶石版本老舊,並且出現語法錯誤。於是我安裝RVM和這樣做:安裝RVM後無法加載Sass/Compass,與Symfony2中的Assetic一起使用

$ rvm use 1.9.3 
$ rvm --rvmrc --create use [email protected] 
$ gem install sass [--pre] 
$ gem install compass [--pre] 
$ updatedb 
$ locate sass | grep myapp | grep bin 
$ locate compass | grep myapp | grep bin 

複製和粘貼這些路徑config.yml

sass: 
     bin: /usr/local/rvm/gems/[email protected]/gems/sass-3.2.0.alpha.277/bin/sass 
     #apply_to: "\.scss$" 
    compass: 
     bin: /usr/local/rvm/gems/[email protected]/gems/compass-0.13.alpha.0/bin/compass 
     apply_to: "\.scss$" 

一切有關指南針和薩斯切換到RVM之前工作的罰款。 北斗/薩斯似乎仍然從app_dev.php工作,但他們分手時,我試圖轉儲資產進行生產:

$ rm -r app/cache/ # this is how I delete cache, any other way give me errors, even before having this compass problem. This have always worked fine. I removed the * because this code block was interpreting it as a comment 
$ php app/console assetic:dump --env=prod --no-debug 
Dumping all prod assets. 
Debug mode is off. 

00:05:36 [file+] /home/www/dev/public/myapp/app/../web/css/fcd6640.css 



    [Assetic\Exception\FilterException]                             
    An error occurred while running:                              
    '/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby' '/usr/local/rvm/gems/[email protected]/gems/compass-0.13.alpha.0/bin/compass' 'compile' '/t 
    mp' '--config' '/tmp/assetic_compassF1Mv7t' '--sass-dir' '' '--css-dir' '' '/tmp/assetic_compassKDoaEA.scss'           

    Error Output:                                   
    /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- sass (LoadError 
)                                      
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'          
    from /usr/local/rvm/gems/[email protected]/gems/compass-0.13.alpha.0/lib/compass/dependencies.rb:6:in `rescue in <top (required)>'   
    from /usr/local/rvm/gems/[email protected]/gems/compass-0.13.alpha.0/lib/compass/dependencies.rb:1:in `<top (required)>'      
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'          
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'          
    from /usr/local/rvm/gems/[email protected]/gems/compass-0.13.alpha.0/lib/compass.rb:5:in `block in <top (required)>'       
    from /usr/local/rvm/gems/[email protected]/gems/compass-0.13.alpha.0/lib/compass.rb:4:in `each'            
    from /usr/local/rvm/gems/[email protected]/gems/compass-0.13.alpha.0/lib/compass.rb:4:in `<top (required)>'         
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'          
    from /usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'          
    from /usr/local/rvm/gems/[email protected]/gems/compass-0.13.alpha.0/bin/compass:20:in `block in <main>'          
    from /usr/local/rvm/gems/ruby-1.9.[email protected]/gems/compass-0.13.alpha.0/bin/compass:8:in `fallback_load_path'         
    from /usr/local/rvm/gems/[email protected]/gems/compass-0.13.alpha.0/bin/compass:19:in `<main>'            


    Output:                                    
    Unable to load Sass. Please install it with one of the following commands:                   
    gem install sass --pre                                


    Input:                                    
    $main-color: red;                                  

    body {                                    
    color: $main-color;                                 
    } 

另一個錯誤我已經越來越:

Error Output:                                   
/usr/local/rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find compass (>= 0) amongst [big decimal-1.1.0, io-console-0.3, json-1.5.4, minitest-2.5.1, rake-0.9.2.2, rdoc-3.9.4] (Gem::LoadError) 

相關:@mpapis @jamz Sass broken after install with RVM, using Assetic PHP

我想添加更多標籤:指南針和sass。不確定是否可以用更高的分數完成。

UPDATE

我說像這樣的包裝:

$ rvm wrapper [email protected] php sass compass 

而且再次編輯config.yml,但現在我得到交替這些錯誤,隨機:

錯誤1:

[Assetic\Exception\FilterException]                             
    An error occurred while running: '/usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby' '/usr/local/rvm/bin/php_compass' 'compile' '/tmp' '--config' '/tmp/assetic_compass0Tmn8t' '--sass- dir' '' '--css-dir' '' '/tmp/assetic_compasssw2S3k.scss'                        

    Error Output: /usr/local/rvm/rubies/ruby-1.9.3-p194/bin/ruby: no Ruby script found in input (LoadError)            
Input:                                    
    $main-color: red;                                  

    body  {                                    
    color: $main-color;                                 
    } 

錯誤2:

Error Output: /usr/local/rvm/gems/[email protected]/gems/bundler-1.1.5/lib/bundler/shared_helpers.rb:22:in `default_gemfile': Could not locate Gemfile (Bundler::GemfileNotFound)                                 
from /usr/local/rvm/gems/[email protected]/gems/bundler-1.1.5/lib/bundler.rb:213:in `default_gemfile' 

羅盤仍然能正常通過app_dev.php

回答

-3

解決方案

只需使用lessphp。它可以與作曲家進行安裝,然後在config.yml:

lessphp: 
     php: %kernel.root_dir%/../vendor/leafo/lessphp/lessc.inc.php 
     apply_to: "\.less" 
+0

不是你使用sass嗎? – alex88 2012-12-05 11:11:11

+1

@ alex88我試過了,我真的這樣做過。過去我曾經使用紅寶石和鐵軌。足夠的紅寶石廢話,php +少贏。 – ChocoDeveloper 2012-12-05 12:03:41

+0

哦,當然:)我也是,它可以是PITA有時..一個不錯的東西是精靈世代:) – alex88 2012-12-05 14:04:01

2

我猜你需要的包裝:

rvm wrapper [email protected] php sass compass 

這將產生的包裝,它調用適當的紅寶石(RVM)環境中,使用他們像:

sass: 
    bin: /usr/local/rvm/bin/php_sass 
    #apply_to: "\.scss$" 
compass: 
    bin: /usr/local/rvm/bin/php_compass 
    apply_to: "\.scss$" 
+0

謝謝,我試過,但它扔了不同的錯誤,我更新我的帖子 – ChocoDeveloper 2012-08-01 05:31:28

+0

這是完全隨機的,現在它說「無法找到的Gemfile (捆紮機:: GemfileNotFound)」。看起來像一個指南針的錯誤,因爲我沒有使用Bundler。 – ChocoDeveloper 2012-08-01 05:36:14

+0

第二次錯誤嘗試'gem uninstall ruby​​gems-bundler' - 在'compass'中有一個錯誤,當與'rubygems-bundler'連接時可能會產生這個錯誤 – mpapis 2012-08-01 05:59:03