rake db:migrate error (Function 'inotify_init' not found)

♀尐吖头ヾ 提交于 2019-12-09 07:13:24

问题


I just got done setting up my rails environment on my old mac book and ran into this error. I've installed FFI and rb-inotify. I've also ran bundle install again. I've looked at

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

and

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

which both indicate that this is a linux specific API. There is a suggestion on the second of those links that says I should just remove that gem and things that depend on it, but I am hesitant to remove FFI which seems to depend on it.

What course of action do you suggest? Any advice on this matter is greatly appreciated.

EDIT: I'm running rails 3.2.7 (updating to 3.2.11 tonight).

EDIT 2: I found this: Rubygems: How do I add platform-specific dependency?. Is this helpful?

EDIT 3: Do you think it might have something to do with rbenv?

EDIT 4: I changed my development gem from rb-inotify to rb-fsevent, ran bundle install then did db:migrate.

And it continues to run the migration.

Hmmm... I'm asking my team members that use macs have tried executing rake db:migrate since our Linux developer added rb-inotify to our gem set.

This link may be helpful to someone who comes this way: https://supportbee.com/devblog/2012/07/18/using-platform-dependent-gems-rb-inotify-and-rb-fsevent/

EDIT 5: I've been looking at the guard gem, specifically this part:

I added this, and it will perform the rake db:migrate, but I still get a list of errors very similar to:

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

I think I'm progressing to a full solution!

EDIT 7: Look at this stackoverflow question for the remaining errors due to the libnotify gem: Image Not Found Errors after Upgrade to Rails 3.1, how to fix?. It suggests doing this:

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

回答1:


Essentially, someone on my team added Linux specific installation of some stuff. To fix it, do the following:

For rb-inotify stuff, do this:

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

If you have libnotify, do this:

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

Worked for me, happy coding!



来源:https://stackoverflow.com/questions/14299757/rake-dbmigrate-error-function-inotify-init-not-found

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!