1

I'm using Docker to build a rails app.

When I run rails console, rails server... they all give error related to rb-inotify library.

/usr/local/bundle/gems/rb-inotify-0.9.7/lib/rb-inotify/notifier.rb:58:in `initialize': Function not implemented - Failed to initialize inotify (Errno::ENOSYS)

Docker version: 20.10.11

Ruby version: 2.2.3

Rails version: 5.0.0.1

Mac mini (M1, 2020)

I have also tried some of the fixes on some of the pages below, but it still doesn't work. Hope everybody help please!!!

https://github.com/evilmartians/terraforming-rails/issues/34

How to fix "Function not implemented - Failed to initialize inotify (Errno::ENOSYS)" in rails

/usr/local/bundle/gems/rb-inotify-0.9.7/lib/rb-inotify/notifier.rb:58:in `initialize': Function not implemented - Failed to initialize inotify (Errno::ENOSYS)
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/adapter/linux.rb:31:in `new'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/adapter/linux.rb:31:in `_configure'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/adapter/base.rb:45:in `block in configure'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/adapter/base.rb:40:in `each'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/adapter/base.rb:40:in `configure'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/adapter/base.rb:63:in `start'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/backend.rb:28:in `start'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/listener.rb:67:in `block in <class:Listener>'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/fsm.rb:120:in `instance_eval'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/fsm.rb:120:in `call'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/fsm.rb:91:in `transition_with_callbacks!'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/fsm.rb:57:in `transition'
    from /usr/local/bundle/gems/listen-3.0.8/lib/listen/listener.rb:90:in `start'
    from /usr/local/bundle/gems/spring-watcher-listen-2.0.1/lib/spring/watcher/listen.rb:27:in `start'
    from /usr/local/bundle/gems/spring-2.0.0/lib/spring/application.rb:70:in `start_watcher'
    from /usr/local/bundle/gems/spring-2.0.0/lib/spring/application.rb:79:in `preload'
    from /usr/local/bundle/gems/spring-2.0.0/lib/spring/application.rb:143:in `serve'
    from /usr/local/bundle/gems/spring-2.0.0/lib/spring/application.rb:131:in `block in run'
    from /usr/local/bundle/gems/spring-2.0.0/lib/spring/application.rb:125:in `loop'
    from /usr/local/bundle/gems/spring-2.0.0/lib/spring/application.rb:125:in `run'
    from /usr/local/bundle/gems/spring-2.0.0/lib/spring/application/boot.rb:19:in `<top (required)>'
    from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from /usr/local/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54:in `require'
    from -e:1:in `<main>'
Trung Tran
  • 11
  • 2
  • 1
    Can you edit the question to include a [mcve], with enough source code to demonstrate the problem? – David Maze Jan 19 '22 at 12:06
  • When you say you "tried some of the fixes", _which_ ones did you try? It doesn't help us help you unless we know what you did. See "[ask]" and its linked pages and "[mcve]" for more information. – the Tin Man Jan 28 '22 at 18:11

1 Answers1

0

For Rails 5.0.x is recommended to use ruby 2.4. Update your ruby ​​version ​​and try again.

Reference: https://www.fastruby.io/blog/ruby/rails/versions/compatibility-table.html

Pedro Paiva
  • 721
  • 11
  • 17
  • 2
    I tried the above versions in a linux environment and it worked fine, only when I switched to mac environment with the M1 chip, I got the above error. – Trung Tran Jan 20 '22 at 16:46