I keep getting this error when i try to run my app:
C:/ruby-2.0.0-p195-i386-mingw32/lib/ruby/gems/2.0.0/gems/activesupport-4.0.0.rc1
/lib/active_support/dependencies.rb:228:in `require': cannot load such file -- 2
.0/bcrypt_ext (LoadError)
Any takers? - im trying to use the devise gem for basic user authentication..
I've gotten this error when I updated to Ruby 2.0.0+ on Windows. I was able to solve it by uninstalling all versions of bcrypt that were downloaded, and building the gem using DevKit.
gem uninstall bcrypt-ruby
gem install bcrypt-ruby --platform=ruby --no-ri --no-rdoc
Usually doing a bundle update will download a precompiled gem mingw32 extension, which in this case appears not to work. This workaround for reinstalling bcrypt-ruby will hopefully not be needed in the future.
Additionally, I keep updated Windows installation instructions for Ruby on Rails here (mostly for my own reference) for installing Ruby on Rails on Windows.
https://github.com/remomueller/documentation/tree/master/windows
Some other Windows pitfalls you may run into are also listed there:
https://github.com/remomueller/documentation/blob/master/windows/190-miscellaneous.md
Until this problem is fixed, the best workaround is to install bcrypt-ruby from git:
gem 'bcrypt-ruby', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
Update (June 2016.) - as #gneri mentioned, bcrypt-ruby changed it's name to bcrypt, so use:
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
On problem with has_secure_password on Window 7 helps this
gem uninstall bcrypt-ruby
gem uninstall bcrypt
gem install bcrypt-ruby --platform=ruby --no-ri --no-rdoc
gem install bcrypt --platform=ruby --no-ri --no-rdoc
Add to Gemfile:
gem 'bcrypt-ruby', '~> 3.0.0', :require => 'bcrypt'
gem 'bcrypt'
bundle install
turns out that it was a problem with the version of ruby that i was using. I was using ruby 2 (32bit).
but if you switch to the 64bit version of ruby 2 the error goes away.
Seems like the downfall of using windows as a development platform for ROR apps. I need to use Ruby 2.0 32 bit in order to get PG gem for a postgresql connection to work or I have to use Ruby 2.0 64 bit to get 'Devise' gem to work.
The new version of bundler just came out. It nows about x64 gems
gem install bundler -v '1.4.0.pre.2'
Related
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.
I have tried to deploy devise authentication on my rails app.
I am getting this issue
"cannot load such file -- bcrypt_ext"
I see it is a common issue amongst windows based computers but the answers to other questions have not helped me yet.
I am running Windows 8 x64 with x86 ruby and devkit
try
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
reference: https://www.alib.jp/entries/bcrypt_ext_load_error_on_ruby21x
bcrypt_ext.so file is missing -if you manually copy it to proper folder - in my case \Ruby23\lib\ruby\gems\2.3.0\gems\bcrypt-3.1.11-x86-mingw32\lib - it helps. :)
This worked for me:
https://github.com/codahale/bcrypt-ruby/issues/142
-Uninstall all bcrypt versions: gem uninstall bcrypt
select option 3 (uninstall all)
-Uninstall all bcrypt-ruby versions: gem uninstall bcrypt-ruby
select option 3 (uninstall all)
replace the line in your gemfile by:
to add this line to the gemfile:
gem 'bcrypt', platforms: :ruby
did not work for me though but to point the gemfile to the git repository did:
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
bundle install
and you should be good to go
At this link https://github.com/codahale/bcrypt-ruby/issues/142
Somebody mentioned this solution
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
And it worked for me
I've changed in my gemfile the rails version from 3.2.12 to 4.2.0
then I got this error:
The bundle currently has rails locked at 3.2.12
so I tried bundle update / and bundle update rails ... but I got this:
Bundler could not find compatible versions for gem "rails":
In Gemfile:
prototype-rails (>= 0) ruby depends on
rails (~> 3.2) ruby
rails (4.2.0)
What do I have to do?
Update Gemfile:
source 'http://rubygems.org'
#gem 'rails', '3.2.12'
gem 'rails', '4.2.0'
gem "airbrake"
#gem "mysql"
gem 'mysql2', '~>0.3.7'
gem 'fastercsv'
gem 'newrelic_rpm', :group => [:production, :staging]
gem "xml-simple", :require => "xmlsimple"
gem "will_paginate", "~> 3.0.0"
gem "json", '1.7.7'
gem "default_value_for"
gem "whenever"
gem 'charlock_holmes'
gem 'prototype-rails'
gem 'rails_autolink'
group :development do
gem 'capistrano'
gem 'capistrano-ext'
end
Just run
bundle update
without telling to update just a specific gem (like rails). This allows bundler to find the lastest possible combination for all gems in the Gemfile.
The prototype-rails gem is not actively supported anymore. You should try to replace it as soon as possible (even if the latest version still works for you).
Furthermore: Multiple configuration settings have changed between Rails 3.2 and 4.2, you will have to change some of your config and core files. You also might want to read the Rails Guide: Upgrading Rails.
I suggest to upgrade your app in smaller steps (3.2 -> 4.0, 4.0 -> 4.1, 4.1 -> 4.2). Make sure that the app works in each step before you continue to the next. Also, watch out for deprecation warnings in the console or the logs.
remove your gemfile.lock
rm Gemfile.lock
then add
rails 4.2.0 in your Gemfile
then
bundle install
I think, the problem is in prototype-rails
https://github.com/rails/prototype-rails
Below Comment of prototype-rails gem
Unfortunately, due to limited manpower and resources, the Rails core team has not been able to confirm if this gem currently works with Rails 4.1 and above. If you have found any problems while upgrading your application, please report them at the issue tracker, or better yet, submit patches by sending a pull request.
Tried to remove first remove prototype-rails then run
bundle update
I'm beginner in Ruby on Rails and trying to learn from http://ruby.railstutorial.org/ I'm creating sample_app and got stuck at chapter 6.
My Ruby version: ruby 2.0.0p195 (2013-05-14) [i386-mingw32]
My Rails version: Rails 4.0.0
I have following line in my GemFile:
gem 'bcrypt-ruby', '~> 3.0.0'
If I type gem list bcrypt-ruby , it shows bcrypt-ruby (3.0.1) . But if I try to create user, I get error saying
You don't have bcrypt-ruby installed in your application. Please add it to your Gemfile and run bundle install
I searched a lot on rails website, bcrypt website & even stackoverflow. But, nothing worked. Please help.
I've faced this issue recently (as have many others). As per ladyruby723 posted here, use gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt' in your gemfile file.
I solved this the same problem by the following line:
gem 'bcrypt-ruby', '~> 3.1.2'
I believe this exact issue is solved in another question. There are actually two error messages produced, this being the higher level one, by searching for the lower level I found the below answer.
can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.1. Make sure all dependencies are added to Gemfile
add below in gem file
gem 'bcrypt', git: 'https://github.com/codahale/bcrypt-ruby.git', :require => 'bcrypt'
and run bundle install and restart server
Finally... Got it working. I didn't understand the exact issue but I made two important changes. I'm not sure which change made it working.
I uninstalled my old ruby & rails that were installed from railsinstaller. Installed just ruby for my OS (64 bit which I was not able to choose while installing from railsinstaller). Then I installed rails, sqlite3 separately.
Another important change I did is in Gemfile.lock. I think this did the trick. I kept both of the following lines
bcrypt-ruby (3.0.0)
bcrypt-ruby (3.0.0-x86-mingw32)
In my case, the problem was that bcrypt version 3.1.2 was outdated. Fortunately Ruby has a way of installing the most up to date version of a particular gem right from your command line. In this case I typed in
bundle pristine bcrypt
but more generally you can do
bundle pristine gem name
If you think you might be running into a similar issue with a different gem
I can't get MongoMapper to work with my Rails app. I get this error message:
**Notice: C extension not loaded. This is required for optimum MongoDB Ruby driver performance.
You can install the extension as follows:
gem install bson_ext
If you continue to receive this message after installing, make sure that the
bson_ext gem is in your load path and that the bson_ext and mongo gems are of the same version.
I have installed DevKit and installed the gem: gem install bson_ext --no-rdoc --no-ri (result: bson_ext-1.0.1 installed)
I'm running on Windows 7. The Rails version is 2.3.7. I used the RubyInstaller when installing. Can anyone point me in the right direction?
The problem is: the bson_ext gem version and the mongo gem version need to match, also, mongo_mapper isn't ready for mongo-1.0.1 yet, so the versions of the mongo and bson_ext gems you should be using are 1.0 for each, respectively.
so, do the following:
gem install mongo -v=1.0 --no-ri --no-rdoc && \
gem install bson_ext -v=1.0 --no-ri --no-rdoc
then for Rails 2.x in your config/environment.rb do:
config.gem 'mongo', :version => '1.0'
config.gem 'bson_ext', :version => '1.0'
or for Rails 3, in your Gemfile:
gem 'mongo', '1.0'
gem 'bson_ext', '1.0'
This is generally caused by installing a version of bson_ext not equal to the version number required by MongoMapper. Check which version of bson MongoMapper is requiring, and then make sure that you have that version and no other installed.
I needed specify the bson version to get this to work, like so:
gem 'mongo', "1.1"
gem 'bson', "1.1"
gem 'bson_ext', "1.1"
(Using rails 3)
I followed the instructions above but still the "no such file to load 'bson_ext'. I went to the gem and tried moving the folders in the "ext" folder up one level (to the root of the gem) and lo and behold, it worked. FWIW...
Include the following in your environment.rb
config.gem 'bson_ext', :version => "1.0", :lib => "bson_ext/cbson"
Install bson_ext using:
gem install bson_ext
Add the gem to your Gemfile:
gem 'bson_ext'
Run bundle in your project root level directory.