middleman server error with 'listen' 3.0.3 gem instead of 2.10.1 - bundler

I'm running on windows 8.1 and try to run 'middleman server' (with gem version 2.4.8 and Middleman version 3.3.12). When doing so I get the following error (see below appendix for full error message): " You have already activated listen 3.0.3, but your Gemfile requires listen 2.10.1"
Yet the gem 'Listen' is not explicitely written in my gemfile, must be a dependency with something else.
So what I did was to explicitely add in my gemfile :
gem 'listen', '~> 2.10.1'
And then run again
$bundle install
Yet when I run again '$middleman server' it does not work. So in my terminal I check which version of 'listen' gem I have and see that it's :
C:\Users\Edouard\Desktop\stylus>bundle show listen
C:/Ruby22/lib/ruby/gems/2.2.0/gems/listen-2.10.1
Would someone have a lead on how to solve that ? Because I don't have a clue..
Appendix - The whole error message I get is :
C:\Users\Edouard\Desktop\stylus>middleman server
WARN: Unresolved specs during Gem::Specification.reset:
rack (< 2.0, >= 1.0, >= 1.0.0, >= 1.4.5)
uber (~> 0.0.4)
activesupport (>= 3.1, ~> 4.1)
ffi (>= 0.5.0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:34:in `block in setup': You have already activated listen 3.0.3, but your Gem
file requires listen 2.10.1. Prepending `bundle exec` to your command may solve this. (Gem::LoadError)
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/runtime.rb:19:in `setup'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler.rb:127:in `setup'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/bundler-1.10.6/lib/bundler/setup.rb:8:in `<top (required)>'
from C:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from C:/Ruby22/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:69:in `require'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/middleman-core-3.4.0/lib/middleman-core/load_paths.rb:29:in `setup_load_paths'
from C:/Ruby22/lib/ruby/gems/2.2.0/gems/middleman-core-3.4.0/bin/middleman:10:in `<top (required)>'
from C:/Ruby22/bin/middleman:23:in `load'
from C:/Ruby22/bin/middleman:23:in `<main>'

I had same trouble: middleman server error with 'listen' 3.0.3 gem instead of 2.10.1.
Try remove /Gemfile.lock and exec bundle install.
That worked for me.

The issue is apparently linked to the gem middleman-deploy on windows 8.1.
Here is the solution I apply using github :
remove middleman-deploy from gemfile
in the same folder than the gemfile create a rakefile (without any extension) on which you put require 'middleman gh-pages'
then after you made some changes to your work, do a commit on master branch
then do rake publish

Related

Bundler misses gems on Mac

I have problems loading gems with bundler. Happens only in my mac environment. The gem cannot be found via bundler, but when I install the gem globally via gem install #{gem} it works.
I suppose this is something environment specific, but I am not sure how to debug it. I have the same versions of ruby, ruby-install and chruby and bundler on a Ubuntu box, but it works just fine.
So far I had this problem with the gems spring-comands-rspec and rack-cors.
Broken environment (Mac):
OS: Darwin nb-mjacobus2 16.7.0 Darwin Kernel Version 16.7.0: Thu Jun 15 17:36:27 PDT 2017; root:xnu-3789.70.16~2/RELEASE_X86_64 x86_64
Bundler: 1.15.4
ruby-install: 0.6.1
chruby: 0.3.9
ruby: ruby 2.4.1p111 (2017-03-22 revision 58053) [x86_64-darwin16]
Exposing the error:
Gemfile
group :development do
# ...
gem 'spring-commands-rspec'
# ...
end
Running tests
./bin/rspec spec/controller/some_controller_spec.rb:8
/$HOME/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- spring-commands-rspec (LoadError)
from /$HOME/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /$HOME/.spring.rb:2:in `<top (required)>'
from /$HOME/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /$HOME/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /$HOME/.gem/ruby/2.4.1/gems/spring-2.0.2/lib/spring/commands.rb:29:in `<module:Spring>'
from /$HOME/.gem/ruby/2.4.1/gems/spring-2.0.2/lib/spring/commands.rb:4:in `<top (required)>'
from /$HOME/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /$HOME/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /$HOME/.gem/ruby/2.4.1/gems/spring-2.0.2/lib/spring/server.rb:9:in `<top (required)>'
from /$HOME/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /$HOME/.rubies/ruby-2.4.1/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /$HOME/.gem/ruby/2.4.1/gems/spring-2.0.2/lib/spring/client/server.rb:9:in `call'
from /$HOME/.gem/ruby/2.4.1/gems/spring-2.0.2/lib/spring/client/command.rb:7:in `call'
from /$HOME/.gem/ruby/2.4.1/gems/spring-2.0.2/lib/spring/client.rb:30:in `run'
from /$HOME/.gem/ruby/2.4.1/gems/spring-2.0.2/bin/spring:49:in `<main>'
Manually installing the gem solves the problem....
gem install spring-commands-rspec
Fetching: spring-commands-rspec-1.0.4.gem (100%)
Successfully installed spring-commands-rspec-1.0.4
Parsing documentation for spring-commands-rspec-1.0.4
Installing ri documentation for spring-commands-rspec-1.0.4
Done installing documentation for spring-commands-rspec after 0 seconds
1 gem installed
... BUT I get this warnings:
./bin/rspec spec/pattern_library_controller_spec.rb
WARN: Unresolved specs during Gem::Specification.reset:
minitest (~> 5.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
WARN: Unresolved specs during Gem::Specification.reset:
minitest (~> 5.1)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Running via Spring preloader in process 53164
Run options: include {:focus=>true}
All examples were filtered out; ignoring {:focus=>true}
Randomized with seed 5284
SomeController
should respond with a success status code (2xx)
Finished in 0.13193 seconds (files took 0.66951 seconds to load)
1 example, 0 failures
Randomized with seed 5284
Any idea what the problem could be?
For some reason the gems were installed inside inside vendor/bundle, but not all of them. Removing rm -rf .bundle vendor/bundle && bundle install did it.
The content of .bundle/config was:
---
BUNDLE_WITHOUT: "development:related"
TL;DR; Try to move spring-commands-rspec to test group in Gemfile:
group :development
# ...
# ...
end
group :test do
# ...
gem 'spring-commands-rspec'
end
OR group :development, :test do if you need the gem not only for tests.
In short: There is Environment concept, when you run something in Rails. Loaded gems are also depend on it through Gemfile - Bundler loads common gems and gems from corresponding groups. The default environment is development, but rspec uses test one. So, gems from group development are not loaded when you run rspec ... if they are not listed in group test also.
UPDATE:
It seems you have set up your app in server mode(may be you get install command from deploy script). Because it's pretty typical to have .bundle dir and vendor/bundle when deploy Rails app on the staging/production server(i.e. gems are installed locally with app).
But in that case you .bundle/config should include BUNDLE_PATH at least:
BUNDLE_FROZEN: "1"
BUNDLE_PATH: "./vendor/bundle"
BUNDLE_WITHOUT: "development:test"
BUNDLE_DISABLE_SHARED_GEMS: "true"

Ruby bundler installing unwanted version of puppet gem

I have the following script
PUPPET_VERSION=3.7.4
ruby='1.8.7-p374'
rvm use $ruby#$$ --create
gem install bundler
bundle install --gemfile=.gemfile
This has worked for several months but sadly now it has decided to stop working.
After this script rake is called to run some rspec tasks
On the centos 6.6 bamboo test runner the process fails.
On the centos 6.4 development machine it still works
On my development machine this script (+rake tasks ) works like so
Fetching gem metadata from http://rubygems.org/.........
Fetching version metadata from http://rubygems.org/..
Installing rake 10.4.2
Installing CFPropertyList 2.2.8
Installing builder 3.2.2
Installing diff-lcs 1.2.5
Installing facter 2.4.1
Installing json_pure 1.8.2
Installing hiera 1.3.4
Installing metaclass 0.0.4
Installing mocha 1.1.0
Installing puppet 3.7.4
Installing puppet-lint 1.1.0
Installing puppet-syntax 1.4.1
Installing rspec-core 2.99.2
Installing rspec-expectations 2.99.2
Installing rspec-mocks 2.99.3
Installing rspec 2.99.0
Installing rspec-puppet 2.0.0
Installing puppetlabs_spec_helper 0.8.2
Installing rspec_junit_formatter 0.2.0
Using bundler 1.9.4
Bundle complete! 3 Gemfile dependencies, 20 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
manifests found
~/gitf/puppetmaster_np/local_modules/iop_4store/spec/fixtures/modules ~/gitf/puppetmaster_np/local_modules/iop_4store
~/gitf/puppetmaster_np/local_modules/iop_4store
/home/jan/.rvm/rubies/ruby-1.9.3-p484/bin/ruby -S rspec ./spec/classes/iop_4store_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null
WARN: Unresolved specs during Gem::Specification.reset:
rake (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
Removing gemset 16612......
However on the bamboo agent node it does this
The source :rubygems is deprecated because HTTP requests are insecure.
Please change your source to 'https://rubygems.org' if possible, or 'http://rubygems.org' if not.
Using rake 10.4.2
Using CFPropertyList 2.2.8
Using builder 3.2.2
Using diff-lcs 1.2.5
Using facter 2.4.3
Using json_pure 1.8.2
Using hiera 2.0.0
Using metaclass 0.0.4
Using mocha 1.1.0
Using puppet 4.0.0
Using puppet-lint 1.1.0
Using puppet-syntax 2.0.0
Using rspec-support 3.2.2
Using rspec-core 3.2.3
Using rspec-expectations 3.2.1
Using rspec-mocks 3.2.1
Using rspec 3.2.0
Using rspec-puppet 2.0.1
Using puppetlabs_spec_helper 0.10.2
Using rspec_junit_formatter 0.2.0
Using bundler 1.9.4
Bundle complete! 3 Gemfile dependencies, 21 gems now installed.
Use `bundle show [gemname]` to see where a bundled gem is installed.
manifests found
~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/fixtures/modules ~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store
~/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store
/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby -I/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-support-3.2.2/lib:/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null
WARN: Unresolved specs during Gem::Specification.reset:
rake (>= 0)
WARN: Clearing out unresolved specs.
Please report a bug if this causes problems.
/usr/local/rvm/gems/ruby-1.9.3-p484/gems/puppetlabs_spec_helper-0.10.2/lib/puppetlabs_spec_helper/module_spec_helper.rb:23:in `block in <top (required)>': undefined method `environmentpath=' for #<RSpec::Core::Configuration:0x000000025a4068> (NoMethodError)
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core.rb:101:in `configure'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/puppetlabs_spec_helper-0.10.2/lib/puppetlabs_spec_helper/module_spec_helper.rb:22:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:135:in `rescue in require'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:144:in `require'
from /home/bamboo/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/spec_helper.rb:2:in `<top (required)>'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /usr/local/rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_require.rb:55:in `require'
from /home/bamboo/bamboo-agent-home/xml-data/build-dir/PUP-RCTAP-JOB1/local_modules/iop_4store/spec/classes/iop_4store_spec.rb:1:in `<top (required)>'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `load'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1226:in `block in load_spec_files'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `each'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/configuration.rb:1224:in `load_spec_files'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:97:in `setup'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:85:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:70:in `run'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib/rspec/core/runner.rb:38:in `invoke'
from /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec:4:in `<main>'
/usr/local/rvm/rubies/ruby-1.9.3-p484/bin/ruby -I/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-support-3.2.2/lib:/usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/lib /usr/local/rvm/gems/ruby-1.9.3-p484/gems/rspec-core-3.2.3/exe/rspec --pattern spec/\*\*\{,/\*/\*\*\}/\*_spec.rb --no-drb -r rspec_junit_formatter --format RspecJunitFormatter -o junit.xml --deprecation-out /dev/null failed
/usr/local/rvm/gems/ruby-1.9.3-p484#27314 did not previously exist. Ignoring.
The tests fail and I'm sure that having a wildly different version of puppet (and other gems) is not helping. Also, our systems aren't running puppet 4
Here is the gemfile that is being used
source :rubygems
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>=
2.7']
gem 'puppet', puppetversion
gem 'puppetlabs_spec_helper', '>= 0.1.0'
gem 'rspec_junit_formatter'
So my problem is that the scripts shown previously loaded the correct gems into rvm and executed the tests "as if" puppet 3.7.0. Now they try and load puppet 4 and the tests fail.
Thanks
Here's what I did to "make it work" Not entirely sure why this fixed it
First, alter the gemfile to copy most of the versions of the gem dependencies from the other server where it still works
source 'https://rubygems.org'
puppetversion = ENV.key?('PUPPET_VERSION') ? "= #{ENV['PUPPET_VERSION']}" : ['>=
2.7', '< 4.0']
gem 'diff-lcs', '1.2.5'
gem 'facter'
gem 'hiera', '1.3.4'
gem 'json_pure', '1.8.2'
gem 'metaclass', '0.0.4'
gem 'mocha', '1.1.0'
gem 'puppet', puppetversion
gem 'puppet-lint', '1.1.0'
gem 'puppet-syntax', '1.4.1'
gem 'puppetlabs_spec_helper', '0.8.2'
gem 'rake'
gem 'rspec', '2.99.0'
gem 'rspec-core', '2.99.2'
gem 'rspec-expectations', '2.99.2'
gem 'rspec-mocks', '2.99.3'
gem 'rspec-puppet', '2.0.0'
gem 'rspec_junit_formatter', '0.2.0'
Next, add a couple of "bundle update" and a "bundlee clean --force" to the script.
PUPPET_VERSION=3.7.4
ruby='1.9.3-p484'
rvm use $ruby#$$ --create
gem install bundler
ln -s .gemfile Gemfile
bundle clean --force
bundle update rspec
bundle install --gemfile=.gemfile
bundle update rspec
(the eagle eyed will note that I'm running a different ruby too)

Bundler error when executing berks command from a rake task on windows

I wrote a rake task to execute the berks package command on a Berksfile in a sub-directory:
task :cook do
`berks package ./cookbooks.tar.gz -b ./cookbook/Berksfile`
end
I've also tried these variations:
task :cook do
`.\\scripts\\berks_package.bat` # containing stuff
end
task :cook do
`C:\\opscode\\chefdk\\embedded\\bin\\ruby.exe "C:\\opscode\\chefdk\\bin\\berks" package ..\\cookbooks.tar.gz -b ..\\cookbook\\Berksfile`
end
No matter the way I execute berks, the task fails with the following error:
C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/resolver.rb:434:in `version_conflict': Bundler could not find compatible versions for gem "nokogiri": (Bundler::VersionConflict)
In snapshot (Gemfile.lock):
nokogiri (1.6.5)
In Gemfile:
albacore (~> 2.0.0) x86-mingw32 depends on
nokogiri (~> 1.5) x86-mingw32
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/resolver.rb:232:in `resolve_for_conflict'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/resolver.rb:250:in `resolve_conflict'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/resolver.rb:373:in `resolve'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/resolver.rb:166:in `start'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/resolver.rb:129:in `resolve'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/definition.rb:193:in `resolve'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/definition.rb:132:in `specs'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/definition.rb:177:in `specs_for'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/definition.rb:166:in `requested_specs'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/environment.rb:18:in `requested_specs'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/runtime.rb:13:in `setup'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler.rb:122:in `setup'
from C:/tools/ruby213/lib/ruby/gems/2.1.0/gems/bundler-1.7.9/lib/bundler/setup.rb:17:in `<top (required)>'
from C:/opscode/chefdk/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from C:/opscode/chefdk/embedded/lib/ruby/site_ruby/2.0.0/rubygems/core_ext/kernel_require.rb:54:in `require'
rake aborted!
Albacore::CommandFailedError: Command failed with status (1):
.\scripts\berks_package.bat
Executing berks package ./cookbooks.tar.gz -b ./cookbook/Berksfile from a command prompt works as does executing other normal system commands inside the task.
Gemfile:
source 'https://rubygems.org'
gem 'albacore', '~> 2.0.0'
gem 'semver2', '~> 3.4.0'
Gemfile.lock
GEM
remote: https://rubygems.org/
specs:
albacore (2.0.16)
map (~> 6.5)
nokogiri (~> 1.5)
rake (~> 10)
semver2 (~> 3.4)
map (6.5.5)
mini_portile (0.6.1)
nokogiri (1.6.5-x64-mingw32)
mini_portile (~> 0.6.0)
rake (10.4.2)
semver2 (3.4.0)
PLATFORMS
x64-mingw32
DEPENDENCIES
albacore (~> 2.0.0)
semver2 (~> 3.4.0)
I figured out the problem as I wrote the question and stumbled upon new ideas.
The root problem was that the Ruby binary and gems installed with the ChefDK were conflicting with the system install of Ruby. Specifically, the rake task was executed under the system Ruby installation, but when berks was executed, it ran under the embedded ChefDK Ruby. I'm not clear on this next part, but it seems that the ChefDK Ruby was aware of the Gemfile and tried to resolve the dependencies itself, but because nokogiri cannot be resolved (i.e. built) by bundler on Windows without pain, it failed.
Here is what I did to resolve the issue:
Uninstalled the system Ruby
Added C:\opscode\chefdk\bin to the system PATH variable so I could run ruby, rake, gem, bundle, etc.
Ran gem install nokogiri (now executed under the ChefDK's Ruby)
Recreated the Gemfile.lock file by running bundle install
Surrounded the berks system call with a Bundler.with_clean_env block (this is key!)
Thanks to this question
The task now looks like:
task :cook do
Bundler.with_clean_env do
`berks package cookbooks.tar.gz -b .\\cookbook\\Berksfile`
end
end

"no such file to load -- rspec/expectations (LoadError)"

My Gemfile currently specifies the following:
gem "rspec-expectations", "2.7.0"
When I try to run Cucumber, I get the following:
no such file to load -- rspec/expectations (LoadError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require'
/Library/Ruby/Gems/1.8/gems/rspec-2.7.0/lib/rspec.rb:2
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:36:in `require'
/Users/rthomas/dev/companyname/ci/behavior_testing/features/support/env.rb:4
....
The Gemfile I'm working with specifies v 2.7.0, so I tried updating that and re-running Cucumber, and I got the following:
can't activate rspec-expectations (~> 2.7.0, runtime) for ["rspec-2.7.0"], already activated rspec-expectations-2.14.5 for [] (Gem::LoadError)
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:230:in `activate'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:246:in `activate'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `each'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems.rb:245:in `activate'
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/1.8/rubygems/custom_require.rb:35:in `require'
/Users/rthomas/dev/companyname/ci/behavior_testing/features/support/env.rb:4
....
And obviously, when I uninstall 2.7.0 and just use the latest RSpec version, I get a RubyGem version error.
I found this post and tried updating my version of the rspec-rails gem, but no joy.
I need to work within the constraints of the Gemfile I've been given, so is there any way to fix the initial error (no such file to load -- rspec/expectations (LoadError)) while using version 2.7.0?
Found this article, which talks about the "diff-lcs" gem. OP had two different versions installed, and the newer one was causing a conflict. I checked my Gemlist, discovered I had the right one (v. 1.1.3) and a newer one (v 1.2.5), so I simply uninstalled the newer version and I was able to run my cucumber tests.

Thin + EventMachine fails to start

While loading a Thin webserver for a sinatra app I keep getting
Unable to load the EventMachine C extension; To use the pure-ruby reactor, require em/pure_ruby'<path>/vendor/bundle/ruby/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/eventmachine.rb:8:in `require': cannot load such file -- rubyeventmachine (LoadError)
from <path>/vendor/bundle/ruby/1.9.1/gems/eventmachine-1.0.0.rc.4/lib/eventmachine.rb:8:in `<top (required)>'
from <path>/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin.rb:7:in `require'
from <path>/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/lib/thin.rb:7:in `<top (required)>'
from <path>/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/bin/thin:5:in `require'
from <path>/vendor/bundle/ruby/1.9.1/gems/thin-1.5.0/bin/thin:5:in `<top (required)>'
from <path>/vendor/bundle/ruby/1.9.1/bin/thin:19:in `load'
from <path>/vendor/bundle/ruby/1.9.1/bin/thin:19:in `<main>'
In my Mac OSX I boot the server without any problems but in my server which is a
Red Hat Enterprise Linux Server release 6.2 (Santiago)
I can't start my app.
I'm using rvm 1.18.5 and ruby-1.9.3-p374
Regards and thanks in advance.
Anyone came across this issue?
I've worked around the problem dumping most of my Bundler configured gems and installing them directly on my global gemset. I had to remove all Bundler references from my Sinatra load up code and use only rubygems instead.
Right now I only need Bundler for testing with cucumber and deployment with capistrano.
try reinstall the gem 'eventmachine':
$ gem uninstall eventmachine
$ gem install eventmachine
or
$ bundle install
see: https://stackoverflow.com/a/15140634/445908
I fixed my "Unable to load the EventMachine C extension" error by uninstalling homebrew's version of ruby 2.5. See this comment on Rails/Ruby Error When Creating Database: Unable to load the EventMachine C extension

Resources