William Jones
William Jones

Reputation: 1

Why can't the file tiny_tds.so be found?

I have written a Ruby on Rails app on Windows 10 that uses SQLite3 in development but needs to use SQLServer in production. I am using Ruby 2.3.3 and Rails 5.1.4.

I included the tiny_tds and activerecord-sqlserver-adapter gems in the Gemfile and ran 'bundle install'. This seems to have completed successfully. I then ran 'rails db:migrate RAILS_ENV=production' and got the error 'LoadError: cannot load such file -- tiny_tds/tiny_tds'.

The complete error message output is below. Can you please tell me what the problem may be and what I can do to fix it.

$ rails db:migrate RAILS_ENV=production
rails aborted!
LoadError: cannot load such file -- tiny_tds/tiny_tds
c:/Sites/turkeytote/config/application.rb:7:in <top (required)>' c:/Sites/turkeytote/Rakefile:4:inrequire_relative'
c:/Sites/turkeytote/Rakefile:4:in <top (required)>' bin/rails:4:inrequire'
bin/rails:4:in `

'
LoadError: 126: The specified module could not be found. - c:/RailsInstaller/Ruby2.3.3/lib/ruby/gems/2.3.0/gems/tiny_tds-2.1.0-x86-mingw32/lib/tiny_tds/2.3/tiny_tds.so

Upvotes: 0

Views: 952

Answers (1)

Tom Chapin
Tom Chapin

Reputation: 3566

I ran into this problem recently, and it turns out that the issue was due to the Ruby DevKit not being included in my Windows system and user PATH variables.

I was using the Windows Ruby 2.3 Rails Installer from http://railsinstaller.org/en, which installs Ruby (and related libraries) at the C:\RailsInstaller location by default.

If you open a command prompt and browse to C:\RailsInstaller\DevKit, then run the "devkitvars.bat" file, this will add the relevant paths to your PATH variable: C:\RailsInstaller\DevKit\bin;C:\RailsInstaller\DevKit\mingw\bin;

After doing this, tiny_tds worked, and my rails db:migrate command finally worked successfully.

Note: This is not a permanent fix. To fix the issue permanently, you need to actually edit your Windows PATH settings.

Setting your PATH (on Windows 10 and Windows 8)

  1. In Search, search for and then select: System (Control Panel)
  2. Click the Advanced system settings link.
  3. Click Environment Variables.
  4. In the section System Variables, find the PATH environment variable and select it. Click Edit. If the PATH environment variable does not exist, click New.
  5. In the Edit System Variable (or New System Variable) window, specify the value of the PATH environment variable.
  6. The PATH variable should include this string: "C:\RailsInstaller\DevKit\bin;C:\RailsInstaller\DevKit\mingw\bin;"
  7. Click OK.
  8. Close all remaining windows by clicking OK.
  9. Open a new command prompt and type path to make sure that your changes are in effect.

Upvotes: 1

Related Questions