2013-02-15 67 views
8

Ruby由rbenv安裝。爲什麼在輸入(LoadError)中找不到Ruby腳本?

$ ruby -v 
ruby 1.9.3p327 (2012-11-10 revision 37606) [i686-linux] 

$ which ruby 
/home/user/.rbenv/shims/ruby 

$ which sass 
/home/user/.rbenv/shims/sass 

$ gem list 
*** LOCAL GEMS *** 

bigdecimal (1.1.0) 
bundler (1.2.4) 
io-console (0.3) 
json (1.5.4) 
minitest (2.5.1) 
rake (0.9.2.2) 
rdoc (3.9.4) 
sass (3.2.5) 

這是我config.yml:

# Assetic Configuration 
assetic: 
    // ... 

    ruby: /home/user/.rbenv/shims/ruby 

    filters: 
     cssrewrite: ~ 
     sass: 
      bin: /home/user/.rbenv/shims/sass 

     // ... 

這是錯誤我得到:

[message] An error occurred while running: 
'/home/user/.rbenv/shims/ruby' '/home/user/.rbenv/shims/sass' '--load-path' '/path/to/symfony2/src/My/AnyBundle/Resources/public/css' '--cache-location' '/tmp' '/tmp/assetic_sassYbl6MI' 

Error Output: 
ruby: no Ruby script found in input (LoadError) 

我在其他設置中的錯誤:

config.yml:

# Assetic Configuration 
assetic: 
    // ... 

    ruby: /home/user/.rbenv/shims/ruby 

    filters: 
     cssrewrite: ~ 
     sass: ~ 

     // ... 

這是我的錯誤:

Error Output: 
ruby: No such file or directory -- /usr/bin/sass (LoadError) 

薩斯不起作用。這是引用寶石的問題嗎?

+0

本文幫助我解決了這個問題:http://vvv.tobiassjosten.net/symfony/compass-loaderror-in-assetic-and-symfony2/?utm_source=feedburner&utm_campaign=Feed%3A+symfony%2Fplanet+%28Symfony+博客+行星%29&utm_medium =進料 – scones 2017-01-17 17:05:09

回答

1

SF 2.1.7,RVM安裝,安裝指南針,青菜如寶石,格外基於Unable to load Sass/Compass after installing RVM, to use with Assetic in Symfony2

parameters: 
# Assetic 
    assetic.filter.compass.images_dir: %kernel.root_dir%/../web/images 
    assetic.filter.compass.http_path: /images 
    assetic.ruby.bin: 'pathToRubyBin' 

路徑寶石箱,你可以通過檢查:

which ruby 
如上

。 社科院和SCSS使用指南針過濾器:

​​

,這裏是警告!如果您使用rvm或系統紅寶石,則不需要創建100500個包裝器。 只是:

$ which compass 

它是你的pathtocompass。

現在:

{% block stylesheets %} 
    {% stylesheets 'css/general.scss(or .sass)' filter='compass, cssrewrite' output='css/general.css' %} 
     <link rel="stylesheet" type="text/css" media="screen" href={{ asset_url }} /> 
    {% endstylesheets %} 
{% endblock %} 

最後,我gemlist:

~$ gem list 

*** LOCAL GEMS *** 

bigdecimal (1.1.0) 
bundler (1.2.4) 
chunky_png (1.2.7) 
compass (0.12.2) 
fssm (0.2.10) 
io-console (0.3) 
json (1.5.5) 
minitest (2.5.1) 
rake (10.0.3, 0.9.2.2) 
rdoc (3.9.5) 
rubygems-bundler (1.1.0) 
rvm (1.11.3.6) 
sass (3.2.6) 
6

我克隆軌回購後得到這個錯誤:

$ rails server 
c:/RailsInstaller/Ruby1.9.3/bin/ruby.exe: no Ruby script found in input (LoadError) 

的問題是在bin/railsbin/rake。頂線是#!/usr/bin/env,但應該是#!/usr/bin/env ruby

相關問題