Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Can't install compass via rvm

I was a happy and worries-free user of compass in Ubuntu 11.10. I upgraded to 12.04 and got this problem: Compass (ruby) encoding error

I somehow managed to solve it installing ruby via rvm on one of my computers but now I get a different error in my other computer (which had the same initial problem). I install ruby and compass and use the global gemset as default:

    gem list

*** LOCAL GEMS ***

bundler (1.1.3)
chunky_png (1.2.5)
compass (0.12.1)
fssm (0.2.9)
rake (0.9.2.2)
rubygems-bundler (1.0.0)
rvm (1.11.3.3)
sass (3.1.18)

But when I try to do anything with compass, I get this error:

    compass
/home/mrpotato/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/shared_helpers.rb:22:in `default_gemfile': Could not locate Gemfile (Bundler::GemfileNotFound)
    from /home/mrpotato/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler.rb:213:in `default_gemfile'
    from /home/mrpotato/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler.rb:164:in `root'
    from /home/mrpotato/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler.rb:123:in `load'
    from /home/mrpotato/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler.rb:114:in `setup'
    from /home/mrpotato/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler.rb:119:in `require'
    from /home/mrpotato/.rvm/gems/ruby-1.9.3-p194@global/gems/compass-0.12.1/bin/compass:25:in `<top (required)>'
    from /home/mrpotato/.rvm/gems/ruby-1.9.3-p194@global/bin/compass:19:in `load'
    from /home/mrpotato/.rvm/gems/ruby-1.9.3-p194@global/bin/compass:19:in `<main>'
    from /home/mrpotato/.rvm/gems/ruby-1.9.3-p194@global/bin/ruby_noexec_wrapper:14:in `eval'
    from /home/mrpotato/.rvm/gems/ruby-1.9.3-p194@global/bin/ruby_noexec_wrapper:14:in `<main>'

Thanks for your help.

like image 482
Cmorales Avatar asked May 15 '12 23:05

Cmorales


4 Answers

It appears to be a problem with the new version of rubygems-bundler that was just released. Installing the previous version (gem install -v 0.9.2 rubygems-bundler) fixed it for me.

Edit: I also ran rubygems-bundler-uninstaller which may have been the real source of the fix.

like image 57
Russell Davis Avatar answered Nov 09 '22 15:11

Russell Davis


I ran into this problem today when trying to install Compass/SASS/RVM on a mac with Mountain Lion.

I couldn't get rubygems-bundler-uninstaller to run/uninstall, so I had to do the following:

  1. Switch to the rvm global gemset and uninstall rubygems-bundler rvm ruby-1.9.3-p194@global then gem uninstall rubygems-bundler

  2. Then switch back to my other gemset - rvm ruby-1.9.3-p194 and now running compass or sass or whatever gem works

Not sure if it is the correct way of doing things, but it worked for me. Hope that helps someone.

like image 21
gmclelland Avatar answered Nov 09 '22 15:11

gmclelland


it's a bug in compass it assumes that existence of Bundler means Bundler.setup was called.

Here are the lines that break it https://github.com/chriseppstein/compass/blob/stable/bin/compass#L24-L26:

24 if defined?(Bundler)
25   Bundler.require :assets
26 end
like image 1
mpapis Avatar answered Nov 09 '22 16:11

mpapis


If you're using yeoman for building a node-based app that just happens to want to use compass, you can disable the Gemfile requirement for these types of apps.

Just add this line to your ~/.bash_profile:

export NOEXEC_EXCLUDE="compass"

Run source ~/.bash_profile and try it again. I was having this issue when running grunt server on a yeoman-generated angular project (which doesn't need a Gemfile).

https://github.com/mpapis/rubygems-bundler#disabling-executables

like image 1
yurisich Avatar answered Nov 09 '22 15:11

yurisich