oveits / ProvisioningEngine

Ruby on Rails based ProvisioningEngine Frontend for provisioning of legacy systems via Apache Camel Backend (SOAP/XML+SPML+File import)
3 stars 6 forks source link

rake aborted with error 'LoadError: cannot load such file -- bcrypt_ext' #60

Closed oveits closed 7 years ago

oveits commented 8 years ago

After installing RailsInstaller Windows Ruby 2.2 on my new notebook, and trying to run my ProvisioningEngine, I have encountered following error while trying to migrate the database:

$ bundle exec rake db:migrate RAILS_ENV=development
== 20160211102316 AddAdminUserIfEmptyTable: migrating =========================
rake aborted!
LoadError: cannot load such file -- bcrypt_ext

full log:

$ bundle exec rake db:migrate RAILS_ENV=development
== 20160211102316 AddAdminUserIfEmptyTable: migrating =========================
rake aborted!
LoadError: cannot load such file -- bcrypt_ext
D:/veits/RubyOnRails/ProvisioningEnginev0.5.16/db/migrate/20160211102316_add_admin_user_if_empty_table.rb:4:in `change'
C:in `migrate'
LoadError: cannot load such file -- 2.2/bcrypt_ext
D:/veits/RubyOnRails/ProvisioningEnginev0.5.16/db/migrate/20160211102316_add_admin_user_if_empty_table.rb:4:in `change'
C:in `migrate'
Tasks: TOP => db:migrate
(See full trace by running task with --trace)

bcrypt can be found in the project as follows:

$ grep -R bcrypt
config/environments/test.rb:  # OV: Speed up tests by lowering bcrypt's cost function.
config/environments/test.rb:  # see: https://www.railstutorial.org/book/beginning#code-test_bcrypt_cost_factor
config/initializers/devise.rb:  # For bcrypt, this is the cost for hashing the password and defaults to 10. If
config/initializers/devise.rb:  # a value less than 10 in other environments. Note that, for bcrypt (the default
config/initializers/devise.rb:  # Allow you to use another encryption algorithm besides bcrypt (default). You can use
config/initializers/devise.rb:  # Require the `devise-encryptable` gem when using anything other than bcrypt
Gemfile:# gem 'bcrypt', '~> 3.1.7'
Gemfile.lock:    bcrypt (3.1.10)
Gemfile.lock:      bcrypt (~> 3.0)
oveits commented 8 years ago

Here I have found someone with similar problems and a weird workaround, messing around with two bcrypt folders.

However, I have tried with

$ bundle update bcrypt
...
$ bundle install | grep bcrypt
Using bcrypt 3.1.11

After that, the migration was successful:

$ bundle exec rake db:migrate RAILS_ENV=development
== 20160211102316 AddAdminUserIfEmptyTable: migrating =========================
== 20160211102316 AddAdminUserIfEmptyTable: migrated (0.1244s) ================

== 20160212135435 CreatePersistentHashes: migrating ===========================
-- create_table(:persistent_hashes)
   -> 0.0013s
== 20160212135435 CreatePersistentHashes: migrated (0.0059s) ==================

Problem resolved.

oveits commented 8 years ago

bcrypt minimum version should be specified in the Gemfile before I can close this issue...

oveits commented 7 years ago

Gemfile changed and merged to master. Since this issue did not auto-close, I close it manually.