If you employ Windows, it’s essential to admire that there are a number of gems which require exterior libraries as a way to be “built” correctly.
These exterior libraries are typically not current in your system and are required to be put in (and referenced) to get them working. This is why the likes of the MYSQL2 and RMagick gems are seen as “difficult” to put in.
If you are utilizing SQLite3, issues are barely completely different.
This gem has a number of “builds” which are supposed to present performance throughout plenty of platforms (Windows included). Whilst this works in earlier variations of Ruby, it would not work for Ruby 2.5.1+ – therefore the error you are seeing…
can not load such file — sqlite3/sqlite3_native (LoadError)
The error is brought on by the set up & tried utilization of the “mingw32” model of the gem. This model of the gem is pre-compiled with the SQLite core information, however has points when getting used with the later variations of Ruby.
The resolution is to put in the gem for the “ruby” platform (which nonetheless works wonderful in Windows):
gem set up sqlite3 –platform=ruby
This will set up the “native” model of the gem with all the suitable information and so on – however will not use any of the platform-particular performance that comes with the likes of the mingw32 model.
This will work 100% out of the field.
However, there’s one other downside. If you employ “bundler”, it’ll usually override the native gem set up in favour of a platform-particular one. This signifies that in case you run bundle replace / bundle set up, it’ll possible set up the sqlite3 gem with mingw32 platform.
In this occasion, it’s essential to uninstall *any* references to the latter by utilizing “gem uninstall”. Here’s what usually occurs (for us):
- bundle replace [installs sqlite3]
- gem uninstall sqlite3 [shows selection]
- take away “mingw32” variant
- rails s [should work 100%]
This will get the system working with the gem.
The huge downside is that everytime you use the “mingw32” model of the gem, it’ll have a set of references/calls that are designed particularly to name specific components of the gem.
In Ruby 2.5.1+ – for no matter motive – these calls will not be totally used to make sure that the system is ready to take advantage of progress, therefore the error you are seeing. To repair this, you want to have the ability to primarily “force” your system to solely use the “ruby” variant of the gem.
Obviously, in case you’re utilizing the likes of Linux or Mac as a growth surroundings – such a factor may very well be comparatively merely averted. But the place’s the enjoyable in doing one thing that is straightforward? Use Windows!