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

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.

Related

Why does `gem install` succeed but `bundle install` fails?

I'm trying to install gtk3, but bundle install chokes while installing atk. Most of the responses seem to resolve around mismatched versions in the lock file. Removing the lock file doesn't help, neither does installing the matching version of bundle.
$ bundle install
Fetching gem metadata from https://rubygems.org/....
Resolving dependencies...
Using bundler 2.4.6
Fetching native-package-installer 1.1.5
Fetching pkg-config 1.5.1
Installing pkg-config 1.5.1
Installing native-package-installer 1.1.5
Fetching glib2 3.5.1
Installing glib2 3.5.1 with native extensions
Fetching atk 3.5.1
Installing atk 3.5.1 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/gems/atk-3.5.1/dependency-check
rake RUBYARCHDIR\=/home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/atk-3.5.1
RUBYLIBDIR\=/home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/atk-3.5.1
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems.rb:263:in `find_spec_for_exe': can't find gem
rake (>= 0.a) with executable rake (Gem::GemNotFoundException)
from /home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems.rb:282:in `activate_bin_path'
from /home/sproctor/.rvm/gems/ruby-2.7.7/bin/rake:23:in `<main>'
from /home/sproctor/.rvm/gems/ruby-2.7.7/bin/ruby_executable_hooks:22:in `eval'
from /home/sproctor/.rvm/gems/ruby-2.7.7/bin/ruby_executable_hooks:22:in `<main>'
rake failed, exit code 1
Gem files will remain installed in /home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/gems/atk-3.5.1 for inspection.
Results logged to
/home/sproctor/code/lich-5/vendor/bundle/ruby/2.7.0/extensions/x86_64-linux/2.7.0/atk-3.5.1/gem_make.out
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:102:in `run'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/rake_builder.rb:28:in `build'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:170:in `build_extension'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:204:in `block in
build_extensions'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:201:in `each'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/ext/builder.rb:201:in `build_extensions'
/home/sproctor/.rvm/rubies/ruby-2.7.7/lib/ruby/site_ruby/2.7.0/rubygems/installer.rb:843:in `build_extensions'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/rubygems_gem_installer.rb:72:in `build_extensions'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/rubygems_gem_installer.rb:28:in `install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/source/rubygems.rb:200:in `install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/gem_installer.rb:54:in `install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/gem_installer.rb:16:in
`install_from_spec'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/parallel_installer.rb:155:in
`do_install'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/installer/parallel_installer.rb:146:in `block in
worker_pool'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:62:in `apply_func'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:57:in `block in process_queue'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:54:in `loop'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:54:in `process_queue'
/home/sproctor/.rvm/gems/ruby-2.7.7/gems/bundler-2.4.6/lib/bundler/worker.rb:90:in `block (2 levels) in
create_threads'
An error occurred while installing atk (3.5.1), and Bundler cannot continue.
In Gemfile:
atk
However, installing via gem works fine.
gem install atk -v 3.5.1
Building native extensions. This could take a while...
Successfully installed atk-3.5.1
Parsing documentation for atk-3.5.1
Done installing documentation for atk after 0 seconds
1 gem installed
This isn't a great answer, so if someone has a more in depth explanation, please feel free to give a better answer.
gem install gtk3 and bundle install use a different copy of rake.
The only difference between the two is the shebang line. The version from bundler is #!/usr/bin/env ruby_executable_hooks while the other version points to a specific version of ruby.
I'm not sure why this fails for the bundler version.
An easy workaround mentioned here: https://github.com/postmodern/digest-crc/issues/18#issuecomment-652889761 is to add gem "rake" to your Gemfile.

How can I fix charlock_holmes gem so it works on opensuse Tumbleweed?

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.

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.

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.
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

Resources