On a rails project that I know to have been working as recently as Friday I am suddenly getting this message when I try to perform any rake tas开发者_开发技巧ks:
You have already activated launchy 0.3.7, but your Gemfile requires launchy 0.4.0. Consider using bundle exec.
Thinking that was odd I checked out my Gemfile, I am not calling for launchy anywhere (though it is appearing in my Gemfile.lock).
When running bundle show launchy it is informing me that I am using:
Ruby192/lib/ruby/gems/1.9.1/gems/launchy-0.4.0
I've tried running bundle update rake, re-running bundle install, and using both rake db:create and bundle exec rake db:create. What changed?
Looks like you're not using RVM. I would highly recommend installing it.
Assuming that you have an RVM and, for instance, Ruby 1.9.2-p180 installed, I'd do the following:
create a my_project gemset:
rvm gemset create my_project
inside the project's folder create an
.rvmrc
file, with the following line in it:rvm use 1.9.2-p180@my_project
- run
cd .
inside the project dir and accept all the prompts; install
bundler
gem:gem install bundler
- run
bundle
command inside the project root.
That should do the trick. In my example I insist using RVM, as it will isolate all your project gems from the system ones. Once you run bundle
command, Bundler will manage the dependencies for you, so there's obviously no need to explicitly specify launchy
gem in your Gemfile.
In your gemfile, specify the exact version of launchy that you need and run bundle
I believe that launchy is used by capybara or cucumber. Aside from doing a gem uninstall launchy
and re-installing your bundle, I would recommend explicitly adding it to your Gemfile to avoid this issue, since something odd seems to be going on here. For example:
group :test do
gem 'launcy', '=0.4.0'
end
Do you have open_gem
installed on your system? It gets autoloaded by rubygems
and requires launchy, leading to nasty interactions with bundler. Try removing it.
sudo gem uninstall open_gem
See this blog post for details.
精彩评论