2

I have created a admin panel using ROR platform. Now whenever I try to login I'm getting this error :

Cannot load such file bcrypt_ext

I have come across this error in the past but used to rectify it by uninstalling and reinstalling it using the below steps:

  1. shut down all rails servers
  2. uninstall all versions of bcrypt
  3. manually install v3.1.1 (gem install bcrypt --platform=ruby)
  4. update gem files of projects

But this time nothing works. I have referred many links but none helped.

i'am working using Windows 10, Rails 5.1.6 and Ruby 2.3.3.

i have used devise gem for login function and my user model looks like this

class User < ApplicationRecord
 devise :database_authenticatable,#, :registerable,
     :recoverable, :rememberable, :trackable, :validatable 
 end 

admin.controller

class AdminController < ActionController::Base
 protect_from_forgery with: :exception
 before_action :authenticate_user!
end
James Z
  • 12,209
  • 10
  • 24
  • 44
  • Can you share the code you use? – Nico Haase May 28 '18 at 10:00
  • Are you using windows or linux ? – Vishal May 28 '18 at 10:06
  • @NicoHaase There is nothing wrong in code. Because it was working before and i referred this https://stackoverflow.com/questions/29293321/ruby-on-windows-causes-error-cannot-load-such-file-bcrypt-ext/33593911#33593911 every time but now it is not working –  May 28 '18 at 10:07
  • @Vishal yes i have installed ubuntu on windows –  May 28 '18 at 10:08
  • @Amy install `sudo apt-get install libgmp-dev libgmp3-dev` – Vishal May 28 '18 at 10:09
  • It's fine that there is "nothing wrong in code", but without some sample code, we're not able to reproduce the problem – Nico Haase May 28 '18 at 10:10
  • @NicoHaaseI have used devise gem for login functions. I have edited the post. plz, check the code. –  May 28 '18 at 10:43
  • @Vishal I installed that but it is not working –  May 28 '18 at 10:49

1 Answers1

1

The gem's version you're trying to install might not be available yet on Windows. Have you tried installing a previous version of bcrypt? Or take a look at https://github.com/codahale/bcrypt-ruby/issues/139, multiple solutions are provided.

yoones
  • 2,394
  • 1
  • 16
  • 20