rake db:migrate error(未找到函数'inotify_init')

时间:2013-01-13 01:26:28

标签: ruby-on-rails ruby ruby-on-rails-3.2 rake dbmigrate

enter image description here

我刚刚在我的旧Mac书上设置我的rails环境并遇到了这个错误。我已经安装了FFI和rb-inotify。我也再次运行了bundle install。我看了

https://github.com/ffi/ffi/issues/66

https://groups.google.com/forum/?fromgroups=#!topic/ruby-ffi/gj3_k34o80k

这两个都表明这是一个特定于Linux的API。有人建议在第二个链接中说我应该删除那些宝石以及依赖它的东西,但我对删除似乎依赖它的FFI犹豫不决。

您建议采取什么行动?关于这个问题的任何建议都非常感谢。

编辑:我正在运行rails 3.2.7(今晚更新到3.2.11)。

编辑2:我发现了这个:Rubygems: How do I add platform-specific dependency?。这有用吗?

编辑3:你认为它可能与rbenv有关吗?

编辑4:我将我的开发gem从rb-inotify更改为rb-fsevent,运行bundle install然后执行db:migrate。

enter image description here

它继续进行迁移。

嗯...我问我的团队成员使用macs尝试执行rake db:migrate,因为我们的Linux开发人员将rb-inotify添加到我们的gem集。

此链接可能对以这种方式提供帮助的人有所帮助:https://supportbee.com/devblog/2012/07/18/using-platform-dependent-gems-rb-inotify-and-rb-fsevent/

编辑5:我一直在关注guard gem,特别是这部分:

enter image description here

我添加了这个,它将执行rake db:migrate,但我仍然得到一个非常类似的错误列表:

Could not open library 'libgtk-x11-2.0': dlopen(libgtk-x11-2.0, 13): image not found.

我想我正在逐步找到完整的解决方案!

编辑7:请查看此stackoverflow问题,了解由于libnotify gem导致的其余错误:Image Not Found Errors after Upgrade to Rails 3.1, how to fix?。它建议这样做:

gem 'libnotify' if /linux/ =~ RUBY_PLATFORM
gem 'growl' if /darwin/ =~ RUBY_PLATFORM

1 个答案:

答案 0 :(得分:12)

基本上,我团队中的某些人添加了某些东西的Linux特定安装。要解决此问题,请执行以下操作:

对于rb-inotify内容,请执行以下操作:

group :development do
  gem 'rb-inotify', :require => false
  gem 'rb-fsevent', :require => false
  gem 'rb-fchange', :require => false
end

如果您有libnotify,请执行以下操作:

gem 'libnotify' if /linux/ =~ RUBY_PLATFORM
gem 'growl' if /darwin/ =~ RUBY_PLATFORM

为我工作,快乐的编码!