Issue when running Rails server - ruby-on-rails

I have this error message when i run rails server.
cannot load such file -- bcrypt_ext (LoadError)
Please help
Error message snipet

Try uninstalling bcrypt with gem uninstall bcrypt and gem uninstall bcrypt-ruby.
Then reinstall with gem install bcrypt --platform=ruby and add this to your gemfile gem 'bcrypt', platforms: :ruby

Related

Installing the Poppler Gem and getting bundler errors when running the server

I have added and bundled these gems but I keep getting a bundler error
cannot load such file -- gobject_introspection.so (LoadError)
ruby
gem 'poppler', '~> 3.0', '>= 3.0.7'
gem "cairo", github: "rcairo/rcairo"
gem "gtk3", github: "ruby-gnome2/ruby-gnome2"
I think you should also include the gems for glib2 and gobject-introspection .

Rails bcrypt load error

I have been getting this error when ever I have tried starting the server:
d:/RailsInstaller/Ruby2.3.0/lib/ruby/gems/2.3.0/gems/bcrypt-3.1.11-x86-mingw32/l
ib/bcrypt.rb:16:in `require': cannot load such file -- bcrypt_ext
(LoadError)
Funny thing is, I have had this error before and I solved it simply by running gem uninstall bcrypt,then gem uninstall bcrypt-ruby and then by running gem install bcrypt --platform=ruby (bcrypt gem was in the Gemfile). Now that I've added the pagination gems, the error has shown up again. I have tried a lot of possible solutions(like the ones listed here and some others).It didn't work.
Here's the Gemfile(the important bit):
gem 'bcrypt', '~> 3.1.11'
gem 'will_paginate', '3.0.7'
gem 'bootstrap-will_paginate', '0.0.10'
Since I have a Rails 5 version,I know that these are not the final versions of the will-paginate and bootstrap-will_paginate gems and that I may not need the bootstrap-will_paginate gem.But I have tried both with the final versions(and without the bootstrap-will_paginate gem) and I have been getting the same error.Any help would be much appreciated(for the record,I work in Atom IDE on Windows 8.1).
I solve it with uninstall all bcrypt gem versions with gem uninstall bcrypt and select option 3 (if exist) and uninstall all bcrypt-ruby gem versions with gem uninstall bcrypt-ruby and select option 3 (if exist) then install bcrypt using gem install bcrypt --platform=ruby then add this line gem 'bcrypt', platforms: :ruby or gem 'bcrypt', platforms: [:ruby, :x64_mingw, :mingw] to Gemfile, that is it :D.

how to know mongoid gem version?

I am new to ruby on rails and am trying to run my first application which connected to MongoDb. How do i know if I have Mongoid gem installed or if I have to install it? and what is the command to know the gem version.
In my rails application Gemfile I have added:
gem 'mongoid', '~> 5.0.0'
but it gives the error:
usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.13.6/lib/bundler/resolver.rb:366:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'mongoid (~> 5.0.0.1)' in any of the gem sources listed in your Gemfile or available on this machine. (Bundler::GemNotFound)
I think the gem is not present in your local machine. So it's giving you error. Try running command
bundle install
or you can manually install this gem using console by this command
gem install mongoid -v 5.0.0
Hope it helps. Cheers!

LoadError: cannot load such file — bcrypt_ext

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

bcrypt error: Devise ruby 2.0 and rails 4.0

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'

Resources