9

Ruby is installed by rbenv.

$ 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)

This is my config.yml:

# Assetic Configuration
assetic:
    // ...

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

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

        // ...

This is the error I get:

[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)

The error in my other setup:

config.yml:

# Assetic Configuration
assetic:
    // ...

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

    filters:
        cssrewrite: ~
        sass: ~

        // ...

This is the error I get:

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

Sass does not function. Is it a problem referencing the gem?

Cody Gray - on strike
  • 239,200
  • 50
  • 490
  • 574
R.Atim
  • 367
  • 1
  • 7
  • 16
  • This article helped me resolving this issue: http://vvv.tobiassjosten.net/symfony/compass-loaderror-in-assetic-and-symfony2/?utm_source=feedburner&utm_campaign=Feed%3A+symfony%2Fplanet+%28Symfony+Blog+Planet%29&utm_medium=feed – scones Jan 17 '17 at 17:05

3 Answers3

7

I've got this error after cloning a rails repo:

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

The problem was in bin/rails and bin/rake. Top line was #!/usr/bin/env, but should have been #!/usr/bin/env ruby.

kenorb
  • 155,785
  • 88
  • 678
  • 743
faddison
  • 101
  • 1
  • 6
1

Sf 2.1.7, rvm installed, installed compass,sass as gem, particulary based on 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'

path to ruby bin you can check by:

which ruby

as above. For sass and scss use compass filter:

assetic:
    debug:          "%kernel.debug%"
    use_controller: false
    bundles:        [ FOSUserBundle, XcomplSomeBundle ]
    #java: /usr/bin/java
    filters:
        lessphp:
            file: %kernel.root_dir%/../vendor/leafo/lessphp/lessc.inc.php
            apply_to: "\.less$"
        sass: ~
        compass:
            bin: 'pathtocompass'
            apply_to: "~\.(sass|scss)$~"
        cssrewrite: ~

And here is Warning! There is no need 100500 wrappers to create if you use rvm or system ruby. Just:

$ which compass

And it is your pathtocompass.

And now:

{% 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 %}

Finally, my 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)
Community
  • 1
  • 1
ZloyPotroh
  • 377
  • 7
  • 20
1

I faced this issue in Rubymine. This was due to the Auto-detection of bundler being enabled.

Disabling Auto-detection of bundler solved my issue. You can disable bundler like this -

Run->Edit Configurations->Bundler tab in the respective configuration -> Choose Disabled

Satya
  • 1,569
  • 8
  • 13