Issues while facing installing rmagic in Windows - rails 3 (bundle install) - ruby-on-rails

I am trying to get rmagick to work with rails 3 on windows.
I have manually installed the pre-compiled win32 version of rmagick and have this in my Gemfile:
gem "rmagick", "2.12.0"
But when I do bundle install, it tries to fetch it from the source (http://rubygems.org) instead of identifying that it is already installed on the system.
Here's what gem list rmagick shows on my system:
* LOCAL GEMS *
rmagick (2.12.0 mswin32)
My ruby version is ruby 1.8.7 (2010-01-10 patchlevel 249) [i386-mingw32]
Can anyone help me out on how to get this to work on windows?

gem 'rmagick', "2.12.0", :platforms => :mswin, :require => false
However there's a bug in bundler and you will not be able to
require 'rmagick'
in your controllers.

try to run:
set proxy=http://server:port
bundle install

Try to run 'bundle install --local'.

Related

Redmine requires bundler 1.5.0 or higher

I am trying to set up RedMine on Ubuntu 14.04.5 LTS machine and in the end of install have following error:
Redmine requires Bundler 1.5.0 or higher (you're using 1.3.5).
Please update with 'gem update bundler'. (SystemExit)
However, gem update bundlergives me following:
gem update bundler
Updating installed gems
Nothing to update
Moreover:
$ bundle -v
Bundler version 1.15.3
$ gem list | grep bundler
bundler (1.15.3)
I am totally stuck.
Could anybody tell me how to fix it?
I've tried to remove Bundler version check in Gemfile. Then I have following error:
`x64_mingw` is not a valid platform. The available options are: [:ruby, :ruby_18, :ruby_19, :ruby_20, :mri, :mri_18, :mri_19, :mri_20, :rbx, :jruby, :mswin, :mingw, :mingw_18, :mingw_19, :mingw_20] (Bundler::GemfileError)
I've checked solutions here: http://www.redmine.org/issues/19409 and here http://www.redmine.org/issues/19469 - nothing helps...
After this steps: Redmine installation : Error
I have cannot load such file -- bundler/setup (LoadError) error. But bundler is installed and still have version 1.15.3
Please help. I am totally disappointed with these errors.
Sorry for my english.
Try
bundle clean
to remove all bundled gems
Then
bundle install
to install required gems
Edit:
After seeing your new error, look at this answer:
'x64_mingw' is not a valid platform
And this RedMine board post:
http://www.redmine.org/boards/2/topics/45759
An updated bundler gem should be ok, but also check your Gemfile and remove any reference to x64_mingw before running bundle install

LoadError: cannot load such file -- bcrypt_ext on Windows 2008 x64 server

I upgraded my environment from Ruby 2.0.0 to 2.2.3.
I also upgraded (overwrite) DevKit, and re-run ruby dk.rb install.
I removed Gemfile.lock and ran bundle install to start with a brand new environment. Everything looks ok, but I get the error:
E:\Projects\development\Stairs>rake db:migrate
rake aborted!
LoadError: cannot load such file -- bcrypt_ext
E:/Projects/development/Stairs/config/application.rb:7:in `<top (required)>'
E:/Projects/development/Stairs/Rakefile:4:in `<top (required)>'
LoadError: cannot load such file -- 2.2/bcrypt_ext
E:/Projects/development/Stairs/config/application.rb:7:in `<top (required)>'
E:/Projects/development/Stairs/Rakefile:4:in `<top (required)>'
(See full trace by running task with --trace)
I first had the same issue with Nokogiri, which I solved using this solution : Nokogiri load error
using Juloi Elixir's solution and installing Nokogiri from a local copy.
But I don't feel like doing this foreach gem! It looks like ruby is searching the gem using a ./ or ./2.2 path, while gems are stored in a ./2.2.0 path. Is this configurable?
How can I solve this issue?
Note: Gemfile contains gem 'bcrypt', '~> 3.1.10'
Thanks!
I spent an entire hour fixing this, just now.
Well what I did was I followed some advice online to do a
gem install bcrypt --platform=ruby
And then, it worked in irb.
irb(main):001:0> require 'bcrypt'
=> true
Later when I had to do a bundle install, for some odd reason rails installed another bcrypt and the error was back. So I had two folders in my gem root.
bcrypt-3.1.10
bcrypt-3.1.10-x64-mingw32
So, since the first folder was the one that got built with the devkit, and it works. I deleted the contents of the second folder and copied the contents of the first into it.
Seems to be working as I'm writing this.
Solution was here: bcrypt-ruby#github:
Rebuild locally the bcrypt gem:
Change to the gem directory \Ruby22-x64\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x64-mingw32\ext\mri>
Run ruby extconf.rb
Run make
Run make install
Note that this works only if your DevKit environment is correctly setup (run devkitvars.bat).
#user1185081 's solution worked for me in a windows machine. I ran following commands and worked like magic:
$ cd C:\RailsInstaller\Ruby2.2.0\lib\ruby\gems\2.2.0\gems\bcrypt-3.1.10-x86-mingw32\ext\mri
$ ruby extconf.rb
$ C:\<DevKit Path>\devkitvars.bat (assuming you have devkit installed)(Ran this instead of running "make" because it was not recognized as an internal or external command)
$ make install
What worked for me on Windows 7:
gem uninstall bcrypt to uninstall all versions of bcrypt, including those listed as dependencies
gem install bcrypt to reinstall
bundle install
In my case, a designating of the old version to bcrypt in Gemfile was a cause of the error. I removed a designating of the version and run bundle update bcrypt, then it was settled.
Here is the solution worked for me:
C:\> gem uninstall brcypt
C:\> gem install --no-ri --no-rdoc bcrypt
C:\> cd (path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> ruby extconf.rb
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> make
C:\(path to gems root)\bcrypt-3.1.7-x86-mingw32\ext\mri> make install
I had the same problem:
cannot load such file — bcrypt_ext
Windows 8.1 64bit
ruby 2.3.3p222 (2016-11-21 revision 56859) [i386-mingw32]
Rails 5.1.4
My solution:
gem uninstall bcrypt-ruby
gem uninstall bcrypt
gem install bcrypt –platform=ruby
added this whole line to Gemfile:
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
bundle install
This works for me, add this to your gems file:
gem 'bcrypt', '~> 3.1.7', platform: :ruby
This process is for windows:
The problem is with the programs installed on the system.
Uninstall all rails programs:
All Ruby programs.
RailsInstaller.
Removes all files that have been able to uninstall, you have to do it manually inside:
C:\RailsInstaller
Install de ruby version 2.2 from:
http://railsinstaller.org/en
Wait a moment and it's already to go.
MarlonJon.es

Specifying JRuby Version in Bundler

I wasn't able to find a SO QA that could answer this.
I installed JRuby via rvm install jruby and then generated a new rails application. To allow for changing of the ruby version automatically via rvm, I discovered that Bundler allows you to add:
ruby '1.9.3', engine: 'jruby', engine_version: '1.7.12'
See here for reference. Since this is 1.3, I checked my Bundler version within my root app directory:
$ bundle -v
Bundler version 1.6.2
I'm assuming I have this functionality. Now, when I move onto adding this to Gemfile:
source 'https://rubygems.org'
ruby '1.9.3', engine: 'jruby', engine_version: '1.7.12'
gem 'rails', '4.1.1'
gem 'activerecord-jdbcsqlite3-adapter'
And then after running cd .. && cd app I received this issue:
RVM used your Gemfile for selecting Ruby, it is all fine - Heroku does that too,
you can ignore these warnings with 'rvm rvmrc warning ignore /Users/benmorgan/Sites/sigma/Gemfile'.
To ignore the warning for all files run 'rvm rvmrc warning ignore allGemfiles'.
Unknown ruby string (do not know how to handle): ruby-1.9.3,engine:jruby,engine_version:1.7.12.
Do you know how to tell rvm to select the jruby version? Is it possible within the Gemfile?
as suggested by the comment already linking to RVM reports Gemfile ruby as not installed
RVM's support for resolving a Ruby "engine" from the Gemfile is limited and does not match how Heroku is using (parsing) the directive.
if you really want to have it both in the Gemfile use a comment for RVM e.g.
source "https://rubygems.org"
#ruby=jruby-1.7.12
if ENV["JRUBY"] || RUBY_PLATFORM == "java"
ruby "1.9.3", engine: "jruby", engine_version: "1.7.12"
end
gem "rails", "~> 4.1.1"
# ...

Bundler could not find compatible versions for gem "bundler":

Complete new person to Ruby and Rails here... Have tried some tutorials in the past, but that's about it. I'm trying to follow 'Ruby on Rails 3 Tutorial' book and have hit a roadblock that I haven't been able to find any help for after searching on here and the Google..
I haven't actually done anything yet; only:
rails new first_app
then changed the Gemfile sqlite3 to
gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
When I run 'bundle install' I get the following:
Fetching gem metadata from http://rubygems.org/.........
Bundler could not find compatible versions for gem "bundler":
In Gemfile:
rails (= 3.0.1) ruby depends on
bundler (~> 1.0.0) ruby
Current Bundler version:
bundler (1.1.3)
This Gemfile requires a different version of Bundler.
Perhaps you need to update Bundler by running `gem install bundler`?
I've tried uninstalling the bundler via
gem uninstall bundler -v 1.1.3
and then installing bundler v1.0.0 via
gem install bundler -v 1.0.0
but it seems to get me bundler 1.1.2..
I just feel like I've hit a dead end and can't find any more information on how to solve this issue.
Any help would be greatly appreciated and rewarded with copious amounts of bacon...
UPDATE UPDATE UPDATE
I couldn't get bundler v 1.1.2 to uninstall. I finally was able to uninstall all of the gems by doing:
sudo gem list | cut -d" " -f1 > gem_list.txt
cat gem_list.txt | xargs sudo gem uninstall -aIx
cat gem_list.txt | xargs sudo gem install
And then reinstalling... This allowed me to then do the 'bundle install' and get on track.. Thank you all for your help!
it is because gems are also installed in global gemset, and you can uninstall it using:
rvm #global do gem uninstall bundler
but you can also use the other version of bundler using:
gem install bundler -v '~>1.0.0'
bundle _1.0.0_ install
replace 1.0.0 with the version that got installed (if other)
First verify your versions to be sure they're all current:
$ ruby -v
ruby 1.9.3p125 (2012-02-16 revision 34643) [x86_64-linux]
$ rails -v
Rails 3.2.2
$ gem list bundler
*** LOCAL GEMS ***
bundler (1.1.3)
If you need to update ruby, you can download it from https://www.ruby-lang.org or use tools like ruby-build. If you have any version of Ruby 1.9.3 that's fine for now.
To update all your gems:
gem update --system
gem update
Gem may install gems in a few different places, and these can interfere with each other. There are system gems (typically installed by root or by using sudo) and your personal user gems. My favorite way to manage these is with a simple tool called rbenv. A related tool is rvm. Either is fine.
For your first tutorial, you can skip using version numbers in your Gemfile:
- gem 'sqlite3-ruby', '1.2.5', :require => 'sqlite3'
+ gem 'sqlite3-ruby', :require => 'sqlite3'
Bundler will sort everything out the right way. Eventually you'll want to specify version numbers if you're coordinating with other developers, or building production systems.
Feel free to ask questions here and I'll add to this answer.
Maybe you had bundler 1.1.2 AND 1.1.3 installed on your machine (and possibly more versions)
use
gem list bundler
to check which version(s) of bundler you have installed.
Then remove the ones you don't want with
gem uninstall bundler -v VERSION_NUMBER
You can use latest version of Rails 3.0 (3.0.12). It supports the latest bundler, and isn't fundamentally different from 3.0.1
I had this problem and the source was a version specification for bundler in the .gemspec file:
spec.add_development_dependency "bundler", "~> 1.16"
Removing the version number solved the issue:
spec.add_development_dependency "bundler"
Bundler is a dependent gem of rails, because of which you can see it only in gemfile.lock instead of gemfile.
For a particular rails version only a range of bundler gems are compatible. I also got this error and I tried uninstalling that version of bundler gem which I didn't need. I also tried to install forcefully using bundle_x.x.x_install, but when things didn't work I explicitly mentioned the gem specifying the version falling within the range required by rails version I am using. May be it's not the right way but that is how things worked for me.
Sometimes to fix the issue mentioned in the title of this question it is enough to delete Gemfile.lock and run bundle update. I hope it will be helpful for someone.

bundle installed cucumber generators not found

I am trying to install cucumber on rails 2.3.11 (gem -v = 1.6.2) with the following Gemfile
group :test do
gem 'fabrication'
gem 'cucumber'
gem 'cucumber-rails'
end
Bundle install is successful, but I can't find the 'cucumber' generator.
bundle exec script/generate cucumber
/Users/Tim/.rvm/gems/ree-1.8.7-2011.03#new_horizons/gems/rails-2.3.11/lib/rails_generator/lookup.rb:212:Warning: Gem::cache is deprecated and will be removed on or after August 2011. Use Gem::source_index.
/Users/Tim/.rvm/gems/ree-1.8.7-2011.03#new_horizons/gems/rails-2.3.11/lib/rails_generator/lookup.rb:234:Warning: Gem::cache is deprecated and will be removed on or after August 2011. Use Gem::source_index.
Couldn't find 'cucumber' generator
Any thoughts greatly appreciated. I am running:
ruby 1.8.7 (2011-02-18 patchlevel 334) [i686-darwin10.7.0], MBARI 0x6770, Ruby Enterprise Edition 2011.03
tim
When you're running the generators they are actually running in the development environment, not test. Therefore these dependencies won't be loaded. Put them in a group like this instead:
group :development, :test do
gem 'cucumber-rails'
...
end
Secondly, you don't need to specify cucumber as well as cucumber-rails, as the cucumber gem is a dependency of the cucumber-rails gem and will be automatically included.
According to the cucumber-rails documentation, the generate command should be cucumber:install, not just cucumber. It also says it's for Rails 3, not sure if that's true though.
First thought is to upgrade your ruby version. In the long run that will solve more problems as newer gems are becoming dependent on ruby 1.9.2. Install RVM and use that to manage your different ruby versions and gem sets.
The second thing is to do what the error is saying.
gem sources
That will show you which souces and gems you have. Something like this:
*** CURRENT SOURCES ***
http://rubygems.org/
If you know where you specific gem is being hosted then you can add those sources to the top of your bundler file. Usually all you need is http://rubygems.org/.
But you can also add it directly to your sources with this:
gem sources:add `http://rubygems.org/`

Resources