I am trying to generate routes (something that worked fine for a few weeks for the application I'm working on), and suddenly, I am seeing the following message:
You have already activated rake 10.0.3, but your Gemfile requires rake 0.9.2.2. Using bundle exec may solve this.
Doing bundle exec does not solve the problem. Looking through Gemfile.lock, I see the following:
railties (3.2.3)
actionpack (= 3.2.3)
activesupport (= 3.2.3)
rack-ssl (~> 1.3.2)
rake (>= 0.8.7)
rdoc (~> 3.4)
rake (0.9.2.2)
I tried changing that last line to:
rake (>= 0.9.2.2)
Which gives me the following error message:
There was an error in your Gemfile, and Bundler cannot continue.
Any ideas?
Check if rake is there in your Gemfile. If it's not, add it, and specify the version "you already activated".
Then, you'll need to tell bundle to update the rake version it's using for your app:
bundle update rake
It'll update your Gemfile.lock for you.
Reason:
What happens is if you does not mention rake in your gemfile then new version of rails automatically install latest rake for you when you do bundle install. But your gemfile is locked with the older version. This causes problems and the error that you see comes.
So what you need to do is first you uninstall the latest rake version that was installed by using the command
gem uninstall rake
And then mention rake in your gemfile and do -
bundle update rake
or you could try gem uninstall rake. You will be asked if you want to delete all versions - type - yes and then bundle install
Related
I just upgrade my server to ubuntu 20 LTS, Focal Fossa. Afterwards some stuff did not work as it should. One thing I would like to ask you for help is, that my Rails app is no longer deployable with capistrano. Right before the upgrade it worked.
I just run from remote:
cap staging deploy
Eveything works fine, authentication at github and so on, but at the db:migrate part it fails with the following info:
deploy:migrating
01 ~/.rvm/bin/rvm default do bundle exec rake db:migrate
01 rake aborted!
LoadError: libssl.so.1.0.0: cannot open shared object file: No such file or directory -
/home/prod/.rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/x86_64-linux/openssl.so
...
cap aborted!
SSHKit::Runner::ExecuteError: Exception while executing as prod#serverip: Exception while executing as prod#serverip: rake exit status: 1
rake stdout: Nothing written
rake stderr: rake aborted!
LoadError: libssl.so.1.0.0: cannot open shared object file: No such file or directory - /home/prod/.rvm/rubies/ruby-2.4.4/lib/ruby/2.4.0/x86_64-linux/openssl.so
The file is there and the user prod has all rights to access it. There is only one version of ruby on the server installed by rvm. The latest version of openssl is installed on the server. Postgres is running and contains lists all databases as it should.
here the version list from the gemfile.lock:
capistrano (3.14.1)
airbrussh (>= 1.0.0)
i18n
rake (>= 10.0.0)
sshkit (>= 1.9.0)
capistrano-bundler (2.0.1)
capistrano (~> 3.1)
capistrano-npm (1.0.3)
capistrano (>= 3.0.0)
capistrano-nvm (0.0.7)
capistrano (~> 3.1)
capistrano-rails (1.6.1)
capistrano (~> 3.1)
capistrano-bundler (>= 1.1, < 3)
capistrano-rvm (0.1.2)
capistrano (~> 3.0)
What can I do, i hope you can help me!
Thanks and best regards,
Stephan
Hi guys i am currently still learning Ruby. Anyway i am on chapter 13 on web application development.I am stuck at this part for ruby script/generate Entry tittle:string content:text
Based on my research i have came across this link:
Why does Ruby "script/generate" return "No such file or directory"?
Apparently i used Rails 3. so this is what happened.I located to my directory i run this command
D:\RubyProjects/Part-3/Chapter-13/rails/mydiary> rails generate scaffold Entry title:string content:text
Now i got this error:
Bundler could not find compatible version for gem "bundler
Current Bundler version: 1.13.2
This Gemfile requires a different version of Bundler.
And i also tried to run this as well:
install bundle,
gem install bundle
Can anyone help me on this?
You need to install bundler.
gem install bundler
and than
bundle install
after this you can generate scaffold
also look this
I tried another command like this:
bundler exec rails g Entry Title:String content:text
Error appeared like this:
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.1) x64-mingw32 was resolved to 3.0.1, which depends on
bundler (~> 1.0.0) x64-mingw32
Current Bundler version:
bundler (1.13.2)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running gem install bundler?
Could not find gem 'bundler (~> 1.0.0) x64-mingw32', which is required by gem 'rails (= 3.0.1) x64-mingw32', in any of the sources.
I tried to uninstall bundler version 1.13.2
and install bundler version 1.0.0. The same thing appear again.
How do i set the default version for bundler?
I get two different results when using the two commands bundle and bundle update
If I use bundle update, I get the following error:
Resolving dependencies...
Bundler could not find compatible versions for gem "railties":
In Gemfile:
requirejs-rails (>= 0) ruby depends on
railties (~> 3.1.1) ruby
rails (= 4.0.0.rc2) ruby depends on
railties (4.0.0.rc2)
Bundler could not find compatible versions for gem "rails":
In Gemfile:
requirejs-rails (>= 0) ruby depends on
rails (~> 3.1.1) ruby
rails (4.0.0.rc2)
But if I use just bundle, I get the following :
Resolving dependencies...
Bundler could not find compatible versions for gem "activesupport":
In snapshot (Gemfile.lock):
activesupport (3.2.2)
In Gemfile:
rails (= 4.0.0.rc2) ruby depends on
activesupport (= 4.0.0.rc2) ruby
Running `bundle update` will rebuild your snapshot from scratch, using only
the gems in your Gemfile, which may resolve the conflict.
The errors point to two different dependencie issues, but both commands are fetching gem metadata from https://rubygems.org/... and Resolving dependencies..., so how are they different?
I have always used just bundle, but tried bundle update and noticed the difference.
In a nutshell: bundle install handles changes to the Gemfile and
bundle update upgrades gems that are already managed by Bundler.
http://viget.com/extend/bundler-best-practices
Needless to say that bundle and bundle install are the same command, install is the default option for bundle.
bundle is the same as bundle install, which does the following:
Check if a Gemfile.lock exists. If it does, install all gems with the exact versions specified there.
If the lock doesn't exist, install gems as specified in the Gemfile, using the latest available / allowable versions according to the Gemfile. Then create the Gemfile.lock to record what versions have been installed.
bundle update on the other hand, deletes / ignores your Gemfile.lock and goes straight to step two.
The error you're seeing is probably because some gem wants active_support to be in the 3.x.x version range, while you seem to be trying to upgrade to Rails 4.
I don't know what's going on with my installation of ruby / rails under OSX Mountain Lion.
I start with a black rails application, run bundle and listing the installed bundles with bundle show I get this:
[..]
* sqlite3 (1.3.7)
* thor (0.17.0)
* tilt (1.3.3)
* treetop (1.4.12)
[..]
As soon as I run rake db:migrate I get the following error:
Could not find thor-0.17.0 in any of the sources
Run `bundle install` to install missing gems.
But, as shown, thor-0.17 is installed. If I force it:
sudo gem install --version 0.17 thor
Successfully installed thor-0.17.0
1 gem installed
Installing ri documentation for thor-0.17.0...
Installing RDoc documentation for thor-0.17.0...
And run the migration again, I keep having dependency errors (in this case "Could not find formtastic-2.2.1 in any of the sources") for gems that bundle says are already installed. Any help? Thanks
EDIT
Gemfile: http://pastebin.com/WSz5dLrm
Gemfile.lock: http://pastebin.com/2kuFz1kK
So after using your Gemfile I got the following error :
Bundler could not find compatible versions for gem "railties": In
Gemfile:
rails (= 3.2.8) ruby depends on
railties (= 3.2.8) ruby
sass-rails (~> 3.2.3) ruby depends on
railties (3.2.11)
Bundler could not find compatible versions for gem "actionpack": In
snapshot (Gemfile.lock):
actionpack (3.2.11)
In Gemfile:
meta_search (>= 1.1.0.pre) ruby depends on
actionpack (~> 3.1.0.alpha) ruby
Running bundle update will rebuild your snapshot from scratch, using
only the gems in your Gemfile, which may resolve the conflict.
Using rails with the version 3.2.11 fixed the bundle.
Rails 3.2.11 fixes a huge security threat anyway, so update !
At the time I install the Spree site (in according with this guide: http://guides.spreecommerce.com/getting_started.html) , I get this problem:
deploy#bothunter:~/rails$ sudo -i gem install rails
Successfully installed rails-3.2.1
1 gem installed
deploy#bothunter:~/rails$ sudo -i gem install bundler
Successfully installed bundler-1.0.22 1 gem installed
deploy#bothunter:~/rails$ sudo -i gem install spree
Successfully installed spree-1.0.0 1 gem installed
deploy#bothunter:~/rails$ rails new mystore -d mysql create
create README.rdoc
create Rakefile
create config.ru
.....
run bundle install
Fetching source index for https://rubygems.org/
Using rake (0.9.2.2)
Using activemodel (3.2.1)
.....
Using rack-test (0.6.1)
Using hike (1.2.1)
Using actionpack (3.2.1)
.....
Using coffee-rails (3.2.2)
Using jquery-rails (2.0.0)
Using mysql2 (0.3.11)
Using rails (3.2.1)
Using uglifier (1.2.3)
Your bundle is complete! Use bundle show [gemname] to see where a bundled gem is installed.
deploy#bothunter:~/rails$ cd mystore
deploy#bothunter:~/rails/mystore$ spree install
Would you like to install the default gateways? (yes/no) [yes]
...
gemfile spree
gemfile spree_usa_epay
gemfile spree_skrill run
bundle install from "."
git://github.com/spree/spree_usa_epay.git (at 0cb57b4) is not checked out. Please run bundle install precompiling assets
git://github.com/spree/spree_usa_epay.git (at 0cb57b4) is not checked out. Please run bundle install
deploy#bothunter:~/rails/mystore$ bundle install
Updating git://github.com/spree/spree_usa_epay.git
Updating git://github.com/spree/spree_skrill.git
Fetching source index for sitename.com
Bundler could not find compatible versions for gem "rails":
**In Gemfile:
spree_usa_epay (>= 0) ruby depends on
rails (<= 3.1.3, >= 3.1.1) ruby
**rails (3.2.1)**
deploy#bothunter:~/rails/mystore$
But...
deploy#bothunter:~/rails/mystore$ gem --list
rails (3.2.1, **3.1.3**)
railties (3.2.1, **3.1.3**)
rake (0.9.2.2, 0.9.2)
How to solve it?
Spree 1.0 only works with Rails 3.1.3. We'll be looking at supporting Rails 3.2 in the next minor release of Spree. Until that comes out, use 3.1.3, like this:
gem install rails -v 3.1.3
I'm pretty sure the problem here is that the rails version has progressed ahead of what spree is expecting. So if you create the new rails app with the 3.1.3 version by typing in:
rails _3.1.3_ new my_app_name
then you will get past this error. However, after that, I got another error during bundle install that I have not yet solved.