"Bundle install" fails with "thin", and cannot point a different "eventmachine" - ruby-on-rails

I work with Ruby 1.9.3 on Windows.
**I have a trouble to do "bundle install" due to a "thin" gem, for my app.
My original GEMFILE looks like this:
gem "sinatra"
gem "mogli"
gem "json"
gem "httparty"
gem "thin"
Running "bundle install" causes Installing eventmachine (0.12.10) with native extensions which fails. Error is described here: Cannot install thin on windows
Just to mention that "gem install thin" is successful!
Some people on the net, facing this issue, suggested to install
"eventmachine" version 1.0.0.beta.4.1 which I did:
gem list --local shows eventmachine (1.0.0.beta.4.1 x86-mingw32, 1.0.0.beta.2 x86-mingw32)
Yet "bundle install" fails.
In another post: ROR 3.1: Bundle update fails (eventmachine gem)
I followed the advise to specify the exact version of "eventmachine" in GEMFILE, so I edited it like (hopefully I did it right)
gem "sinatra"
gem "mogli"
gem "json"
gem "httparty"
gem "eventmachine" "1.0.0.beta.4.1"
gem "thin"
Now, "bundle install" fails with a different error:
Could not find gem 'eventmachine1.0.0.beta.4.1 (>= 0) ruby' in any of the gem sources listed in your Gemfile.
As I mentioned, this version was successfully installed, and it appears in the local repository.
Please help to make "bundle" "happy" with the right 'eventmachine' version.
Sorry if I missed something basic, or failed to find answer already published.

I think you are missing a comma in this line of the last Gemfile:
gem "eventmachine", "1.0.0.beta.4.1"

Related

'bundle install' keeps installing gem sqlite3 version 1.4.2 even if not in Gemfile

I need sqlite3 v1.3.9 gem installed for my app, so I add this line to the Gemfile:
gem 'sqlite3', '= 1.3.9'
However, when I run 'bundle install', it installs v1.4.2 of that gem.
I modified the above line to
gem 'sqlite3', '= 1.3.9', '< 1.4'
No joy -- sqlite v1.4.2 is installed (even if I remove any reference to 'sqlite3' from the Gemfile completely).
My Gemfile was created when I used rails new appname, so it is not fancy at all... I only added gem devise to it.
Gemfile.lock doesn't contain any reference to sqlite3. I removed it anyway and it didn't help.
As another option, I installed v1.3.9 via gem install sqlite3 -v 1.3.9 and I removed v1.4.2 with
# bundle exec gem uninstal sqlite3
Select gem to uninstall:
1. sqlite3-1.3.9
2. sqlite3-1.4.2
3. All versions
> 2
Successfully uninstalled sqlite3-1.4.2
...but as soon as I tried to add v1.3.9, I got:
# bundle add sqlite3 -v 1.3.9
[!] There was an error parsing `injected gems`: You cannot specify the same gem twice with different version requirements.
You specified: sqlite3 (~> 1.4) and sqlite3 (= 1.3.9). Bundler cannot continue.
# from injected gems:1
# -------------------------------------------
> gem "sqlite3", "= 1.3.9"
# -------------------------------------------
I'd grateful for any hints on why v1.4.2 keeps being installed and, most importantly, how do get the bundler forget about v1.4.2 and accept v1.3.9?
Thanks a lot!
There might be some gem in your app that requires sqlite3-1.4.2 and that is causing an issue with installing sqlite3-1.3.9. You should check your Gemfile.lock and look for any gem that is adding sqlite3-1.4.2 as a dependency.
There should be a gem in your app that requires sqlite3-1.4.2 and that is causing an issue with installing sqlite3-1.3.9. You should check your Gemfile.lock and look for any gem that is adding sqlite3-1.4.2 as a dependency.

Globalid and pg not existing when in gemfile

I am trying to rails server from a cloned repo, I have updated ruby, and rails, followed the rvm process, updated all my gem files, and when I go to serve I receive the message
Could not find globalid-0.3.7 in any of the sources Run bundle
install to install missing gems.
So I do bundle install, then get the error
An error occurred while installing pg (0.20.0), and Bundler cannot
continue. Make sure that gem install pg -v '0.20.0' succeeds before
bundling.
Try to insall that and then get
ERROR: Could not find a valid gem 'globalid-0.3.7' (>= 0) in any
repository ERROR: Possible alternatives: globalid, globalize3
I have googled everything and asked many.
globalid is a dependency of the Rails core gem ActiveJob so it is a required gem to have in your Gemfile.lock. See if it is listed in your Gemfile.lock file. If not you could add it to the top of your gemfile including the version
# gemfile
gem 'globalid', '0.3.7'
Then bundle install. If it works, then you can delete it from your gemfile since it should load automatically when Rails loads (since it is a dependency of Rails' ActiveJob). I've run into a similar issue with another gem and this process worked for me.
It could be a version error. Try using gem 'globalid', '~> 0.4.0' in your gemfile and bundling.

Cannot install gem march_hare

I tried adding this to my Gemfile:
gem 'march_hare', '~> 2.22'
Using bundle install I got this message:
Could not find gem 'march_hare (~> 2.22)' in any of the gem sources listed in
your Gemfile or available on this machine.
On the topmost line in my Gemfile, I have this :
source 'https://rubygems.org'
When I manually visit the rubygems and I m able to find this gem here :
https://rubygems.org/gems/march_hare
How do I install this gem? I don't understand what is happening.
It doesn't work with any jRuby older than 9.0, this was a miss on my part

Error in installing ActiveAdmin gem in rails 4

This is the error after I run bundle install in rails. I'm using rails 4.
I already followed the instruction that given but nothings happen.
Gem::RemoteFetcher::UnknownHostError: no such name (https://rubygems.org/gems/has_scope-0.6.0.rc.gem)
An error occurred while installing has_scope (0.6.0.rc), and
Bundler cannot continue.
Make sure that `gem install has_scope -v '0.6.0.rc'` succeeds
before bundling.
then, this is the gemfile
gem 'activeadmin', github: 'gregbell/active_admin'
gem "meta_search"
gem 'bourbon', '3.2.1'
gem 'has_scope', '0.6.0.rc'
Thank you!
This seems to be a network problem. Try doing traceroute rubygems.org from your terminal and see if you are able to reach rubygems.org. If not try again sometime later or try a different host like http://ruby.taobao.org/. You can change the source in the Gemfile. It is usually the first line of the Gemfile, change from rubygems to the above link I gave you if traceroute does not work out.

Error stating that "bcrypt-ruby is not part of the bundle", how can I add bcrypt-ruby to Gemfile?

When I add has_secure_password to the model (inherited from ActiveRecord::Base), error stating that "bcrypt-ruby is not part of the bundle" occurs.
Here the log is:
Started GET "/users" for 127.0.0.1 at 2012-02-19 16:37:12 +0900
Gem::LoadError (bcrypt-ruby is not part of the bundle. Add it to Gemfile.):
app/models/user.rb:3:in `<class:User>'
app/models/user.rb:1:in `<top (required)>'
app/controllers/users_controller.rb:1:in `<top (required)>'
I installed bcrypt-ruby by
$ gem install bcrypt-ruby
Building native extensions. This could take a while...
1 gem installed
Installing YARD (yri) index for bcrypt-ruby-3.0.1...
Installing RDoc documentation for bcrypt-ruby-3.0.1...
but was no avail.
I tried
$ bundle exec rails server
but was no help.
If I comment out the line "has_secure_password", this error does not come out.
How can I solve this problem?
I already had gem 'bcrypt-ruby', '~> 3.0.0' in Gemfile, and had already ran the command bundle, and yet I still got that message. The problem was that I forgot to restart the server:
touch tmp/restart.txt
As the message says you need to add bcrypt-ruby to your Gemfile (at the root of the project).
Adding
gem "bcrypt-ruby"
and then running bundle install should do the trick (this would fetch the gem if you hadn't already installed it).
You can specify specific versions to, eg
gem "bcrypt-ruby", "~> 3.0.1"
will get you the latest version that is >= to 3.0.1 but less than 3.1. You might do this if 3.0.1 has a bug fix you depend on and you're happy to get more bug fixes but you don't want major changes. There's loads more info on the bundler website.
In your Gemfile add a line
gem 'bcrypt-ruby'
and then from the command line
bundle install
Something that came up for me that is not addressed here yet. I got this error after going to a new system on which I installed Ruby 2.0.x.
It turns out that even if I was using the new bcrypt 3.1.7 it didn't work for me until I ALSO had bcrypt-ruby 3.0.1 in the gemfile. I resisted that when I should have just taken the error at it's word.
gems:
bcrypt (3.1.7 ruby x86-mingw32)
bcrypt-ruby (3.0.1 x86-mingw32, 3.0.0)
gemfile:
gem 'bcrypt-ruby', '~> 3.0.1'
gem 'bcrypt', '~> 3.1.7'
Before adding both I tried all sorts of single version combinations.
Restart the server and reinstall bundle in correct order, that is:
bundle install, bundle update, bundle install
and then server restart.
If you already put the gem in the gem file and bundle installed and you are still getting an error then restart your server.

Resources