Can't install compass via rvm - ruby

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.

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.

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:
Switch to the rvm global gemset and uninstall rubygems-bundler
rvm ruby-1.9.3-p194#global then gem uninstall rubygems-bundler
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.

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

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

Related

`bundler install --deployment` missing `to_yaml`?

I am not a ruby expert, but I have managed to gather enough information to setup a Gemfile and install required Gemfiles.
Lately, however, I've had some problems. For whatever reason, I am now getting this error:
> bundle install --deployment
Unfortunately, a fatal error has occurred. Please see the Bundler
troubleshooting documentation at http://bit.ly/bundler-issues. Thanks!
/usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/lib/bundler/settings.rb:129:in `set_key': undefined method `to_yaml' for {"BUNDLE_FROZEN"=>"1"}:Hash (NoMethodError)
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/lib/bundler/settings.rb:129:in `open'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/lib/bundler/settings.rb:129:in `set_key'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/lib/bundler/settings.rb:17:in `[]='
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/lib/bundler/cli.rb:219:in `install'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/lib/bundler/vendor/thor/task.rb:27:in `__send__'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/lib/bundler/vendor/thor/task.rb:27:in `run'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/lib/bundler/vendor/thor/invocation.rb:120:in `invoke_task'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/lib/bundler/vendor/thor.rb:344:in `dispatch'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/lib/bundler/vendor/thor/base.rb:434:in `start'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/bin/bundle:20
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/lib/bundler/friendly_errors.rb:3:in `with_friendly_errors'
from /usr/lib/ruby/gems/1.8/gems/bundler-1.3.1/bin/bundle:20
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
I have taken a look at the recommended link, but the problem remains. My Gemfile is quite simple:
source "https://rubygems.org"
gem 'sass'
And the accompanying Gemfile.lock:
GEM
remote: https://rubygems.org/
specs:
sass (3.2.6)
PLATFORMS
ruby
DEPENDENCIES
sass
Why is bundler failing to install?
Further details:
Using an older version of bundler (say, 1.2), works just fine. Just not 1.3.1
I am using ruby 1.8.7, and rubygems 1.8.11.
Just had the same issue and solved it by uninstalling the latest bundler version 1.3.1
gem uninstall bundler -v 1.3.1
bundler 1.3.0 should make it pass ;)
edit: no idea why though :|
Any chance the when you installed ruby you didn't have libyaml installed on the system. Ruby requires libyaml for it's standardlib yaml library to function.
Try installing libyaml (look up how to for your particular OS) and then re-installing ruby.

Compass gemfile syntax error on Ubuntu 12.10, Ruby 1.9.3

Having run the standard procedure for installing the rvm, which also installs Ruby 1.9.3, then installing gems for rake, compass, sass, bundler and guard, then adding my gems/bin directory to my path I get the following message on running compass:
/home/m1ke/.rvm/gems/ruby-1.9.3-p362/gems/bundler-1.2.3/lib/bundler/dsl.rb:35:in `rescue in eval_gemfile': Gemfile syntax error: (Bundler::GemfileError)
gem "guard", "~> 1.0.1"
^
from /home/m1ke/.rvm/gems/ruby-1.9.3-p362/gems/bundler-1.2.3/lib/bundler/dsl.rb:32:in `eval_gemfile'
from /home/m1ke/.rvm/gems/ruby-1.9.3-p362/gems/bundler-1.2.3/lib/bundler/dsl.rb:7:in from /home/m1ke/.rvm/gems/ruby-1.9.3-p362/gems/bundler-1.2.3/lib/bundler/definition.rb:18:in `build'
from /home/m1ke/.rvm/gems/ruby-1.9.3-p362/gems/bundler-1.2.3/lib/bundler.rb:144:in `definition'
from /home/m1ke/.rvm/gems/ruby-1.9.3-p362/gems/bundler-1.2.3/lib/bundler.rb:112:in `setup'
from /home/m1ke/.rvm/gems/ruby-1.9.3-p362/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
from /home/m1ke/.rvm/gems/ruby-1.9.3-p362/gems/compass-0.12.2/bin/compass:26:in `<top (required)>'
from /home/m1ke/.rvm/gems/ruby-1.9.3-p362/bin/compass:19:in `load'
from /home/m1ke/.rvm/gems/ruby-1.9.3-p362/bin/compass:19:in `<main>
from /home/m1ke/.rvm/gems/ruby-1.9.3-p362/bin/ruby_noexec_wrapper:14:in `eval'
from /home/m1ke/.rvm/gems/ruby-1.9.3-p362/bin/ruby_noexec_wrapper:14:in `<main>'
All gems were installed with the standard gem install compass syntax, I have also run gem update --system
More information!
The same gem works fine on my Windows install, installed using the Windows RubyInstaller.
Having had no responses I tried removing the gem and installing the ruby-compass package from apt-get. This works fine, but now another gem (not available on apt-get) reports errors the come from both /home/m1ke/.rvm/gems/ruby-1.9.9-p362/ but also from /usr/share/ruby-1.9.1/ which I assume the Compass apt-get installed. So now I may have two Ruby versions fighting...
Found the answer on another thread
Just run rubygems-bundler-uninstaller and the problem was fixed right away. Posting this here instead of just linking as the thread linked didn't come up when I searched my error, as my error was a syntax error whereas the linked post has a "file not found" error.

1.9.3 installed, error message factory_girl requires Ruby version >= 1.9.2

I just installed rbenv with ruby 1.9.3
rbenv version
1.9.3-p327 (set by /Users/me/.rbenv/version)
However, when I tried to run bundle update (inside a project that was created before rbenv was installed), I got an error message that factory_girl required at least ruby 1.9.2. See error message below
If it's relevant, when I do gem --version, I see a reference to 1.8.23.
gem --version
1.8.23
Error message
Installing factory_girl (4.1.0) /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/installer.rb:163:in `install': factory_girl requires Ruby version >= 1.9.2. (Gem::InstallError)
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:101:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:78:in `preserve_paths'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/source.rb:91:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:58:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/rubygems_integration.rb:93:in `with_build_args'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:57:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:49:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/installer.rb:8:in `install'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/cli.rb:268:in `update'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `send'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor.rb:263:in `dispatch'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/lib/bundler/vendor/thor/base.rb:386:in `start'
from /Library/Ruby/Gems/1.8/gems/bundler-1.0.18/bin/bundle:13
from /usr/bin/bundle:19:in `load'
from /usr/bin/bundle:19
Update:
The first answer told me to do three steps
gem install bundle
rbenv rehash
bundle install
I did those steps (it installed bundler) '
gem install bundler
Fetching: bundler-1.2.3.gem (100%)
Successfully installed bundler-1.2.3
1 gem installed
but when I tried 'bundle install, I got the same error message about Factory_girl. Interestingly, I decided to try those three steps again, beginning with gem install bunlder, and it installed it again?!#??
The bundle command you are using is from system Ruby installation which is Ruby 1.8.x.
Try
gem install bundler
rbenv rehash
bundle install
This should solve your problem.

Installing Webistrano on Debian squeeze 64bits

I'm currently trying to install Webistrano on a freshly installed debian squeeze 64bits, but I'm facing some issues that I can't manage to solve.
Note: The machine is created under Xen environment, I don't think this affect the procedure however it seemed important to mention it.
Procedure:
Informations:
Ruby version: ruby 1.8.7 (2010-08-16 patchlevel 302) [x86_64-linux]
Rails version: `Rails 2.3.11
Path modifier with: /usr/lib/ruby/1.8:/var/lib/gems/1.8/bin
Rails env: development
Databases have been created
Databases setups for webistrano are, I believe correct (user/pass/path_to_sock_file)
So, here is what I did:
I first installed the 'basics' packages for such installation:
# apt-get install build-essential ruby rubygems libmysql-ruby libmysqlclient-dev libdbd-mysql-ruby mysql-server unzip rake
Then I have been downloading and extracting the project into /usr/src. After copying and configuring the files for email/databses setups (as suggested by https://github.com/peritor/webistrano), I continued by installing all the gems needed for the project:
bundle install
at this point, the command is stuck and isn't doing anything for an hour.
I know it can happen if the Gemfile is complicate, but it doesn't seem to be the case for me. (see the Gemfile following)
# cat Gemfile
source "http://rubygems.org"
gem 'bundler', "~>1.0.10"
gem "rails", "2.3.11"
gem "mysql"
gem "erubis"
gem "rake"
gem "syntax", "1.0.0"
gem "capistrano", "2.6.0"
gem "open4", "0.9.3"
gem "exception_notification", "2.3.3.0"
group :test do
gem "mocha", "0.9.8"
end
So deciding to go ahead I installed the gems by hands, which once finished gives:
# gem list *gems of Gemfile*
bundler (1.0.10)
rails (2.3.11)
mysql (2.8.1)
erubis (2.7.0)
rake (0.9.2.2)
syntax (1.0.0)
capistrano (2.6.0)
open4 (0.9.3)
exception_notification (2.3.3.0)
mocha (0.9.8)
So I believe everything should be working without having to run: bundle install
This is why I finally tried to create the database's structure with rake:
# rake db:migrate --trace
(in /usr/src/peritor-webistrano-a98ba6b)
rake aborted!
Bundler couldn't find some gems.Did you run `bundle install`?
/usr/src/peritor-webistrano-a98ba6b/config/../config/preinitializer.rb:18
/usr/src/peritor-webistrano-a98ba6b/config/boot.rb:28:in `load'
/usr/src/peritor-webistrano-a98ba6b/config/boot.rb:28:in `preinitialize'
/usr/src/peritor-webistrano-a98ba6b/config/boot.rb:10:in `boot!'
/usr/src/peritor-webistrano-a98ba6b/config/boot.rb:123
/usr/src/peritor-webistrano-a98ba6b/Rakefile:4:in `require'
/usr/src/peritor-webistrano-a98ba6b/Rakefile:4
/usr/lib/ruby/1.8/rake.rb:2383:in `load'
/usr/lib/ruby/1.8/rake.rb:2383:in `raw_load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2017:in `load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:2016:in `load_rakefile'
/usr/lib/ruby/1.8/rake.rb:2000:in `run'
/usr/lib/ruby/1.8/rake.rb:2068:in `standard_exception_handling'
/usr/lib/ruby/1.8/rake.rb:1998:in `run'
/usr/bin/rake:28
According to rake error message, apparently some gems aren't properly installed, which seems weird to be, but I guess he can't find it.
So I double check with bundle tool:
# bundle check
Your Gemfile's dependencies could not be satisfied
Install missing gems with `bundle install`
# bundle show
Could not find gem 'mocha (= 0.9.8, runtime)' in any of the gem sources listed in your Gemfile.
And I'm stuck here, I just don't know how to continue.
I google around about mocha or gemfile issue, but haven't found much relevant.
I hope everything is clear and easy to understand as this is my first post.
Thanks for any reply/hints, also if I manage to evolve I'll try keeping you up to date!
Check these instructions:
http://www.gogolek.co.uk/blog/2012/10/web-application-deployment-webistrano-capistrano/
Additionally I had problems with mysql gem installation on my clean debian 6 64-bit, so I had to run
$ apt-get install libmysqlclient-dev ruby-dev
I ended up with following gems installed
Using rake (0.8.7)
Using activesupport (2.3.11)
Using rack (1.1.6)
Using actionpack (2.3.11)
Using actionmailer (2.3.11)
Using activerecord (2.3.11)
Using activeresource (2.3.11)
Using bundler (1.0.10)
Using highline (1.6.20)
Using net-ssh (2.7.0)
Using net-scp (1.1.2)
Using net-sftp (2.1.2)
Using net-ssh-gateway (1.2.0)
Using capistrano (2.6.0)
Using erubis (2.7.0)
Using exception_notification (2.3.3.0)
Using mocha (0.9.8)
Installing mysql (2.9.1) with native extensions
Installing open4 (0.9.3)
Installing rails (2.3.11)
Installing syntax (1.0.0)
Your bundle is updated! Use `bundle show [gemname]` to see where a bundled gem is installed.

RVM seems to mix gems and binaries between ruby versions

I use RVM and have some legacy projects where I use Ruby 1.8.7, rails 2.3.x, rspec 1.3.0 and rspec-rails 1.3.2. But after installing Ruby 1.9.2 and some gems rvm is messing up the Gem paths for 1.9.2 and my 1.8.7 gemset:
When I run my specs with rake I get the following error:
"\"/home/vermelho/.rvm/gems/ruby-1.8.7-p302#rails2/gems/paperclip-2.3.3/data/paperclip\""
config.load_paths is deprecated and removed in Rails 3, please use autoload_paths instead
config.load_paths= is deprecated and removed in Rails 3, please use autoload_paths= instead
Exception encountered: #<OptionParser::InvalidOption: --loadby>
backtrace:
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/core/option_parser.rb:18:in `parse!'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/core/option_parser.rb:4:in `parse!'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/core/configuration_options.rb:64:in `parse_command_line_options'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/core/configuration_options.rb:46:in `parse_options'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/core/command_line.rb:7:in `initialize'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/monkey/spork/test_framework/rspec.rb:4:in `new'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/rspec-core-2.1.0/lib/rspec/monkey/spork/test_framework/rspec.rb:4:in `run_tests'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:13:in `block in run'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/forker.rb:21:in `block in initialize'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/forker.rb:18:in `fork'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/forker.rb:18:in `initialize'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:9:in `new'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/run_strategy/forking.rb:9:in `run'
/home/vermelho/.rvm/gems/ruby-1.9.2-p0/gems/spork-0.8.4/lib/spork/server.rb:47:in `run'
/home/vermelho/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1558:in `perform_without_block'
/home/vermelho/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1518:in `perform'
/home/vermelho/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1592:in `block (2 levels) in main_loop'
/home/vermelho/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1588:in `loop'
/home/vermelho/.rvm/rubies/ruby-1.9.2-p0/lib/ruby/1.9.1/drb/drb.rb:1588:in `block in main_loop'
In the gemset I currently use rspec 2 is not installed, and my current ruby installation and gemset should know nothing about gems from another ruby installation, right?
I just ran into the same problem. The answer is that spork is running using another version of ruby, likely for another ruby application. Rspec tries to connect to spork if using the --drb option. Spork uses the version of rspec it already has loaded. Easy solution, stop the other spork process before trying to run rspec.
I do not believe that this problem has anything to do with RVM.
I've never seen RVM do that so I suspect something was preexisting then RVM was loaded into the system. Was Ruby 1.8.7 a system-install or were some of the gems loaded outside of RVM? If so RVM can't really do much to corral the pre-existing configurations.
The only other thing I can think of is that Rails captured the paths to the gems, then you installed RVM. I did my Rails installs under RVM, then converted to Rails 3 and upgraded my projects with everything under RVM control and didn't see what you are.
You might need to ask Wayne Seguin (wayneeseguin in #rvm on irc.freenode.net) for some help. I'm pretty sure he'll ask what version of RVM you're on so have the output of rvm -v ready. The current rev as of right now is:
rvm -v
rvm 1.0.21 by Wayne E. Seguin (wayneeseguin#gmail.com) [http://rvm.beginrescueend.com/]

Resources