Can't install compass via rvm

孤街醉人 提交于 2019-12-12 10:36:44

问题


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.


回答1:


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.




回答2:


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.




回答3:


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



回答4:


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



来源:https://stackoverflow.com/questions/10610254/cant-install-compass-via-rvm

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!