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/]
Related
I can install charlock_holmes gem on opensuse, trying to open it up in irb quickly, I get this:
> irb
2.3.0 :001 > require 'charlock_holmes'
LoadError: /home/wpostma/.rvm/gems/ruby-2.3.0/gems/charlock_holmes-0.7.3/lib/charlock_holmes/charlock_holmes.so:
undefined symbol: _ZTIN6icu_538ByteSinkE - /home/wpostma/.rvm/gems/ruby-2.3.0/gems/charlock_holmes-0.7.3/lib/charlock_holmes/charlock_holmes.so
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/wpostma/.rvm/gems/ruby-2.3.0/gems/charlock_holmes-0.7.3/lib/charlock_holmes.rb:1:in `<top (required)>'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `require'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:127:in `rescue in require'
from /home/wpostma/.rvm/rubies/ruby-2.3.0/lib64/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:40:in `require'
from (irb):1
from /home/wpostma/.rvm/rubies/ruby-2.3.0/bin/irb:11:in `<main>'
2.3.0 :002 >
It looks to me like maybe something in charlock_holmes is incompatible with the libicu version inside tumbleweed.
I'm using ruby installed with rvm, and purging all my gemsets and reinstalling does not fix it. Any other ways to get charlock_holmes to work? Maybe I need to install a special copy of libicu (earlier, older) and point the gem at it?
Either of these works. For me the bundle config option works better.
This is a direct command to install the gem, directing it towards the correct libicu version:
gem install charlock_holmes -- --with-icu-dir=/usr/local
This is a command to tell which ever ruby project I install later on this system, will get gems installed by bundler to just work instead of breaking:
bundle config build.charlock_holmes "--with-icu-dir=/usr/local" --global
Since I'm using rvm the above bundle configuration seems to be "global" to that rvm environment only.
In my case, the bundle config is helpful as a large series of actions that would have otherwise failed (installing gems, and bootstrapping a large rails application) just worked.
I am getting the following error each time i try run my app through pow
Bundler::RubyVersionMismatch: Your Ruby version is 1.9.3, but your Gemfile specified 2.0.0
I am just trying to link my project with pow and apparently i have a different version of ruby? i am using rbenv to manage my ruby versions. i have set rbenv to set 2.0.0-p0 locally, if i call ruby -v i get ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.4.0]
$rbenv versions
system
1.9.3-p327
* 2.0.0-p0 (set by /Users/fortknokx/Personal work/cave/.rbenv-version)
i tried to 'rbenv rehash' and refresh the '.ruby-version' nothing seems to convince pow that i am using ruby 2.0.0
The full stack on the error that i get from pow is as follows
~/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-
~/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/definition.rb:361:in `validate_ruby!'
~/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:116:in `setup'
~/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
~/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
~/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'3.5/lib/bundler/definition.rb:361:in `validate_ruby!'
~/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler.rb:116:in `setup'
~/.rbenv/versions/1.9.3-p327/lib/ruby/gems/1.9.1/gems/bundler-1.3.5/lib/bundler/setup.rb:17:in `<top (required)>'
~/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `require'
~/.rbenv/versions/1.9.3-p327/lib/ruby/1.9.1/rubygems/custom_require.rb:60:in `rescue in require'
some how pow thinks i am on 1.9.3-p327?? any one had a simular issue. is it a ruby 2.0.0 thing or is it pow and rbenv having a boxing match?
There are some issues with using pow and rbenv as chronicled here: rbenv does not work well with pow
The problem seems to center on some PATH issues with the powconfig file, hence the reason pow is trying to use your default ruby install (assuming 1.9.x) vs. what you designated via rbenv. If you are using OSX mavericks, add the following to your ~/.powconfig file, restart pow once the change is made, and you should be good to go. (per the last suggestion):
export RBENV_ROOT=/usr/local/var/rbenv # Might not be necessary for pre-Mavericks OSX
eval $(rbenv init -)
export PATH=$(rbenv root)/shims:$(rbenv root)/bin:$PATH
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.
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
I have what looks like multiple versions of rubygems installed on my machine, when i gem list i see all my gems, but when i go to run scripts, i get error messages like
Missing these required gems:
SystemTimer
Is there any methodology I can follow to remove all versions of rubygems but one? Ideally i would like to be able to access all the gems that show up under gem list in my programs.
From Gem Environment
- RUBY EXECUTABLE: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
Still if i run:
$ /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby script/mailer_daemon_fetcher start production
no such file to load -- SystemTimer
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:208:in `load'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `each'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:164:in `process'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `send'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `run'
./script/../config/environment.rb:13
script/mailer_daemon_fetcher:5:in `require'
script/mailer_daemon_fetcher:5
no such file to load -- SystemTimer
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:521:in `new_constants_in'
/Library/Ruby/Gems/1.8/gems/activesupport-2.3.4/lib/active_support/dependencies.rb:156:in `require'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/rails/gem_dependency.rb:208:in `load'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `each'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:307:in `load_gems'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:169:in `process'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `send'
/Library/Ruby/Gems/1.8/gems/rails-2.3.4/lib/initializer.rb:113:in `run'
./script/../config/environment.rb:13
script/mailer_daemon_fetcher:5:in `require'
script/mailer_daemon_fetcher:5
Missing these required gems:
SystemTimer
You're running:
ruby 1.8.7.72 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
rubygems 1.3.5 at /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8, /Library/Ruby/Gems/1.8
note in the above i'm manually calling ruby**/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby** this is the same file that my /usr/bin/ruby is symlinked to, and also my GEM_PATH is set to be /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/gems/1.8
full output of gem environment is available here: http://pastie.org/661104
I think the problem is SystemTimer loads slightly oddly so you need more configuration in environment.rb
The "problem" seems to be that gem is called "SystemTimer" but you need to load "system_timer". In order to accomplish this with environment.rb you should use:
config.gem 'SystemTimer', :lib => 'system_timer'
That seemed to solve the same problem for me.
I have a feeling that you might be using a different version of ruby than ruby gems is. Either that or ruby doesn't know where to look for your gems.
See the the gem installation guide to ensure your environment is configured to use gems.
If you're still having problems after following instructions, ensure that you haven't got multiple versions of ruby installed. In the event that there are multiple version of Ruby available, make sure your scripts are calling the same version of Ruby as gem is. This is done by comparing the gem environment listing for RUBY_EXECUTABLE against your scripts' shebang line. Double check to follow any symlinks, because most distribution based installations of ruby will symlink /usr/bin/ruby to /usr/bin/ruby1.8
You should also check that your gems were installed by the same user who is running the script.
If you ran gem install without root privileges the new gems will be installed in your home directory. If you're running a script that depends on these gems as another user. Those installed gems will not be found. However, there's no problems if your gems are installed by root and a different user is running scripts that requires those gems.
I experienced this problem while switching from Ruby to Ruby Enterprise Edition. I found that I had to install all my required gems again using REE's instance of gem.
gem cleanup
it will delete all old gem versions
you have problems with environment - running gem gets others than when you use rubygems in script
look at output of (especially GEM PATHS)
gem environment
also you can compare results of ruby -e 'p ENV' executed in shell and p ENV execute somewhere in your code — look for differences in gem related stuff
Using RVM https://rvm.io/ you can have different versions of Ruby (Enterprise Edition, MRI, Rubinius, etc) and different gem sets.
Check it out, it is really useful !