【发布时间】:2018-07-24 07:46:38
【问题描述】:
我在 Windows 10 上编写了一个 Ruby on Rails 应用程序,它在开发中使用 SQLite3,但在生产中需要使用 SQLServer。我正在使用 Ruby 2.3.3 和 Rails 5.1.4。
我将tiny_tds 和activerecord-sqlserver-adapter gem 包含在Gemfile 中并运行'bundle install'。这似乎已经成功完成。然后我运行'rails db:migrate RAILS_ENV=production' 并得到错误'LoadError: cannot load such file -- tiny_tds/tiny_tds'。
完整的错误消息输出如下。你能告诉我问题可能是什么以及我可以做些什么来解决它。
$ 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
【问题讨论】:
-
您在哪里托管您的应用程序?安装是否顺利(没有失败的 gem 安装等)?
-
应用托管在公司内网。我在本地使用 SQLite3 数据库对其进行了测试,它工作正常。问题是当我尝试在生产中使用 SQLServer 数据库时。
-
我仍然不是 Rails 专家,但我通过 Heroku 托管我的应用程序,当我迁移时,我在 Heroku 控制台上输入,甚至不必提及环境。它是隐含的。当您执行
db:migrate RAILS_ENV=production时,您是在公司服务器上而不是在您的本地计算机上执行此操作吗? (对不起,如果这听起来微不足道但更好的检查) -
我将 tiny_tds gem 更改为 1.3.0 版,问题就消失了。