I originally posted the question: What does this Cucumber error message mean?
Following the suggestion of uninstalling builder and running bundle worked, for a while. Now I am getting a similar error, but this time on rack.
When I run cucumber features I get the following (previously cucumber has worked):
can't activate rack (~> 1.2.1,
runtime) for ["actionpack-3.0.7",
"railties-3.0.7"], already activated
rack-1.3.0 for ["rack-test-0.6.0",
"cucumber-rails-0.5.0"]
(Gem::LoadError)
Deleting rack just to get cucumber to work doesn't sound like a really good idea to me. How can I fix this problem so it doesn't come back again on another dependency?
I think you could put the exact version numbers for your gems (including Cucumber) in your Gemfile and then run using bundle exec
bundle exec cucumber
This will run the Cucumber version in your Gemfile, which should always keep things working even when you upgrade your system version.
The other option is to use RVM gemsets
Related
I'm new to rails and trying to do some playing around with gems and such.
My case here is that I have this navigation menu on my website and I needed to get the current_page link selected.. rather than building a helper I wanted to install a gem so I went and looked for one and found this one.
I then followed what the documentation said:
In my gemfile I added
gem 'rack_current_page'
Then in the project root config.ru
require ::File.expand_path('../config/environment', __FILE__)
use Rack::CurrentPage
run Rails.application
And finally I ran:
bundle and rails s only to find out I had this error:
uninitialized constant Sprockets::SassCacheStore
The error happens when including the application stylesheet in the layout file.
I'm using the following packages / versions (only listing what might have impact - if I'm missing something let me know)
(<gem> -v)
Rails 4.2.1
Sprockets 3.0.0
Sass 3.4.13
Rack 1.5
While doing the uninstall I removed every line I added - heck I also reset my project files to head since I just started working on it anyways,
ran a fresh bundle, restarted the server, checked the site but all I'm getting is the error above..
I googled and tried to look for a similar question on SO but couldn't find any so the only thing I could really try was the uninstall and reset my git.
I'm definitely looking over something really stupid but can't really find the answer so here I am ;)
Any help is appriciated, thanks in advance and comment if I missed info that you guys need.
time of writing
I actually did a quick gem pristine --all with no results either.
EDIT 1
Okay, so with abit of guesswork and the same situation happening before resulting in the recreation of a fresh app in the (short) past I uninstalled the compass-rails gem and ran bundle afterwhich rails s to test if things started working.
It did. Then I went on and reinstalled compass-rails and it kept working... getting quite confused now :S
Okay so here goes:
I've found the problem and it was solved by actually supplying a version that works with rails 4.2.
The default gem compass-rails installs a version incompatible with sprockets.
When I added the specific version as seen here and ran another bundle the versions of most of the packages I named in the question changed.
console output after gemfile modification included:
Installing sprockets 2.12.3 (was 3.0.0)
Using sprockets-rails 2.3.1 (was 2.2.4)
Installing sass-rails 5.0.1 (was 5.0.3)
Installing compass-rails 2.0.4 (was 2.0.1)
Guess it's just waiting for compass to release a compatible version.
I'm running a Rails 2.3.4 app under ruby 1.8.7 and rvm with a custom gemset.
In trying to get rspec up and running, I've tried several times to uninstall rspec 2 and install rspec and rspec-rails version 1.3.4. However, when I run rspec -v I get 2.10.0 regardless of what I do.
Finally I got this error message:
You are running rspec-2, but it seems as though rspec-1 has been loaded as
well. This is likely due to a statement like this somewhere in the specs:
require 'spec'
Please locate that statement, remove it, and try again.
So it looks like 2.10.0 is actually still loaded. Even if I do a gem uninstall rspec rspec is still loaded. What's going on?
You should use spec (the RSpec 1 executable) instead of rspec, as explained in this answer.
I ran into some problem with passenger on Dreamhost after installing refinerycms with its blog plugin. The rack just failed without any information about the
problem, It only said "... please check the server log ... " and a stack trace
without any message about the error.
After a while trying to reinstall but failed, running in the same problem. I finally have it work by doing 2 steps:
1) bundle install --deployment
==> It now shows the error about the differences in Rack version, my required 1.2.4 but it's 1.2.1 configured.
( I did 'bundle install' before but not solve the problem of rack )
2) I googled and update my Gemfile.lock to 1.2.4
AND IT WORKS ... LIKE MAGIC...
Can someone explain to me :
what did "bundle install --deployment" do differently from
"bundle install" ?
What's "Gemfile" and "Gemfile.lock" different ?
Any idea why It would work if I do like above ?
Thanks a lot
Rails 3's "bundle install" and "bundle install --deployment" both work well except the 2nd one just uses more disk space?
Gemfile keeps track of what gems are necessary and Gemfile.lock also keeps track of all your gems' dependencies
Regarding #3, Dreamhost basically requires rack 1.2.1, which you would normally set by having a line like this in your Gemfile:
gem "rack", "=1.2.1"
I assume that hacking the version into Gemfile.lock works because it is installed on the system already, so your app is able to load it without any problems. But it would certainly be better to just specify it in your Gemfile.
Getting rack-based apps running on Dreamhost can be a bit of a trial. If you continue to have problems, you will probably need to post some more details about your config and any specific errors you're getting.
So I had a couple rails apps with cucumber features on my Macbook Pro when I did the in-place upgrade for Lion.
So now I have XCode reinstalled, updated all my gems, and when I start the rails server everything seems to be good to go. But if I run cucumber features I get the following:
You have already activated rack 1.3.2, but your Gemfile requires rack 1.2.3.
Consider using bundle exec. (Gem::LoadError)
So I deleted Gemfile.lock to get rid of the old gem list, bumped the rails version on Gemfile to the new one, and ran bundle install again, and it did it's thing. No errors, but the cucumber features will not run for the life of me.
Your environment is fine and you always should user bundle exec if you want to execute a gem binary, in this case it will always start executable of version that is declared in Gemfile, in other case without bundle exec it will start binary from version installed in your system, sometimes they could match (but it is only coincidence).
Add something like that to your profile to avoid long command call:
alias bec='bundle exec cucumber -r features'
Trying to squeeze in a fairly new gem, and its causing me to stumble around updating quite a few others including Rails as a whole from 2.3.5 to 2.3.6.
Bundler installs fine.
But when I boot up script/console, I get this :
Loading development environment (Rails 2.3.3)
/Users/macuser/Sites/hq_channel/config/../vendor/rails/railties/lib/initializer.rb:271:in `require_frameworks':RuntimeError: can't activate rack (~> 1.0.0, runtime), already activated rack-1.1.0. Make sure all dependencies are added to Gemfile.
/Library/Ruby/Gems/1.8/gems/bundler-1.0.10/lib/bundler/shared_helpers.rb:117:in `gem': can't activate rack (~> 1.0.0, runtime), already activated rack-1.1.0. Make sure all dependencies are added to Gemfile. (Gem::LoadError)
from /Users/macuser/Sites/hq_channel/vendor/rails/actionpack/lib/action_controller.rb:34
It's strange that it says Rails 2.3.3 .. not sure why..
I can't figure out where/how it's loading or trying to load Rack 1.0.0 now that I've updated it to Rack 1.1.0.
Any ideas?
If you're using Bundler and running into dependency issues using a local binary, try prefixing that script with bundle exec:
bundle exec script/console
Under the hood, this does the following:
Starts a new ruby process that calls Bundler.setup (thereby loading all your bundler deps)
Executes the command you passed bundler exec in the context of your Bundler dependencies
This tends to solve most problems. If you're still having issues after that, your best bet is to verify your shell's environment variables are correct and debug from there.
PS: If your issue is what I think it is, the problem here is that script/console is pulling your system gems instead of the ones provided by bundler, which is why you're seeing the incorrect version of Rack and getting load errors for your other gems.