can't activate bcrypt-ruby (~> 3.0.0), already activated bcrypt-ruby-3.1.1. Make sure all dependencies are added to Gemfile

|▌冷眼眸甩不掉的悲伤 提交于 2019-11-27 13:39:15

In your gemfile, you aren't specifying the version, so you're installing the latest version of bcrypt-ruby which is 3.1.1, but what you need is any version from 3.0.0 to 3.0.9. You can get this by adding a version constraint like so:

gem 'bcrypt-ruby', '~> 3.0.0'

The version requirement comes from ActiveModel's SecurePassword which currently has an explicit dependency on bcrypt-ruby (~> 3.0.0). You can see the dependency on github. When this code is executed, it looks for a version 3.0.0 through 3.0.9 which is not installed and so it throws an error.

This dependency was just updated to '~> 3.1.0' a couple of days ago, but has not made its way into the rails activemodel gem yet. When it does, you'll have to update your version accordingly. Here's the commit if you're curious.

  1. Install both 3.0.1 and 3.1.2 bcrypt version
  2. go to "\Ruby200\lib\ruby\gems\2.0.0\gems\bcrypt-ruby-3.1.2-x86-mingw32\lib"
  3. copy the '2.0' folder
  4. paste into "Ruby200\lib\ruby\gems\2.0.0\gems\bcrypt-ruby-3.0.1-x86-mingw32\lib"
  5. include gem 'bcrypt-ruby' in your Gemfile
  6. bundle install

I had the same problem. Add

gem 'bcrypt-ruby', '~> 3.0.0'

then run bundle install and the restart the server. Worked for me

Remove Gemfile.lock and specify the gem 'bcrypt-ruby', '3.0.0'. Run bundle install. Actually, in local gem file bcrypt-ruby should be uninstalled.

I had the same issue, but the current approach provided gem 'bcrypt-ruby', '~> 3.0.0' didn't work so I actually installed version 3.0.0 adding the line gem 'bcrypt-ruby', '3.0.0' to Gemfile and installing specific version 3.0.0 (although it should work up to version 3.0.9)

gem install --version='3.0.0' bcrypt-ruby

After this, just verify your bundle install, you can run bundle show bcrypt-ruby and then you should have the path where this gem was installed, something like

%RUBY_PATH%/lib/ruby/gems/2.0.0/gems/bcrypt-ruby-3.0.0

after these steps I was able to use the bcrypt without problems... just posting this in the event someone still encounters this issue.

vsr

Use ActiveModel has_secure_password

gem 'bcrypt-ruby', '~> 3.0.0'

Had the same issue. Removing the comment # from above line resolved my issue, as jconley mentioned.

For me it worked by just deleting the dependency for version of bycript in the /active_model/secure_password.rb for development test environment.

I always made sure to add it in production just to 100% safe

discipleartem

In console:

$ gem install bundler
$ gem install bcrypt
$ bundle update bcrypt

Add; gem 'bcrypt-ruby', '~> 3.1.1' to your gemfile

Or if you specifically want 3.0.0, follow Maximus's advice and add: gem 'bcrypt-ruby', '3.0.0'

Then bundle update bcrypt-ruby.

You might also want to try deleting your gemfile.lock and re-running bundle install.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!