Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/adapter/linux.rb:30:in `require': cannot load such file -- rb-inotify (LoadError) #45

Closed
GabLeRoux opened this issue Dec 13, 2016 · 6 comments

Comments

@GabLeRoux
Copy link

GabLeRoux commented Dec 13, 2016

Just installed the gem and having the following error:

$ github-markdown-preview test.md 
Preview available at file:///home/gableroux/test.md.html
/home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/adapter/linux.rb:30:in `require': cannot load such file -- rb-inotify (LoadError)
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/adapter/linux.rb:30:in `_configure'
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/adapter/base.rb:45:in `block in configure'
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/adapter/base.rb:40:in `each'
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/adapter/base.rb:40:in `configure'
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/adapter/base.rb:63:in `start'
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/backend.rb:26:in `start'
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/listener.rb:67:in `block in <class:Listener>'
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/fsm.rb:120:in `instance_eval'
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/fsm.rb:120:in `call'
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/fsm.rb:91:in `transition_with_callbacks!'
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/fsm.rb:57:in `transition'
        from /home/gableroux/.gem/ruby/2.3.0/gems/listen-3.0.3/lib/listen/listener.rb:90:in `start'
        from /home/gableroux/.gem/ruby/2.3.0/gems/github-markdown-preview-4.0.2/lib/github-markdown-preview/html_preview.rb:144:in `start_watch'
        from /home/gableroux/.gem/ruby/2.3.0/gems/github-markdown-preview-4.0.2/lib/github-markdown-preview/html_preview.rb:129:in `watch!'
        from /home/gableroux/.gem/ruby/2.3.0/gems/github-markdown-preview-4.0.2/bin/github-markdown-preview:48:in `<top (required)>'
        from /home/gableroux/.gem/ruby/2.3.0/bin/github-markdown-preview:22:in `load'
        from /home/gableroux/.gem/ruby/2.3.0/bin/github-markdown-preview:22:in `<main>'

https://github.com/guard/listen/blob/v3.0.8/lib/listen/adapter/linux.rb#L30

Points to:
https://github.com/nex3/rb-inotify

$ ruby --version                            
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux]
$ uname -a
Linux zbookarch.local 4.8.13-1-ARCH #1 SMP PREEMPT Fri Dec 9 07:24:34 CET 2016 x86_64 GNU/Linux
$ gem --version                                           
2.5.2
$ github-markdown-preview --version                               
github-markdown-preview version 4.0.2
$ gem list | grep github-markdown-preview
github-markdown-preview (4.0.2)
$ gem list | grep rb-inotify 
rb-inotify (0.9.7, 0.9.5)

That's probably an issue with https://github.com/guard/listen though.

@dmarcotte
Copy link
Owner

Thanks for filing this @GabLeRoux. I was unable to reproduce, but I'm using a mac rather than linux, so possibly that's the difference. Also my gem version is higher than yours:

$ gem --version
2.6.8

Everything else is the same. Does upgrading gem fix you up by any chance?

@GabLeRoux
Copy link
Author

GabLeRoux commented Jan 2, 2017

Well I usually have a lot of problems installing gems using system gem anyway. I Updated pretty much everything and moved to rbenv instead.

$ ruby --version
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
$ gem --version
2.6.8
$  gem install github-markdown-preview
Building native extensions.  This could take a while...
ERROR:  Error installing github-markdown-preview:
        ERROR: Failed to build gem native extension.

    current directory: /home/gableroux/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
/home/gableroux/.rbenv/versions/2.4.0/bin/ruby -r ./siteconf20170102-28261-1l5jhv7.rb extconf.rb
creating Makefile

current directory: /home/gableroux/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR=" clean

current directory: /home/gableroux/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3/ext/json/ext/generator
make "DESTDIR="
compiling generator.c
generator.c: In function ‘generate_json’:
generator.c:861:25: error: ‘rb_cFixnum’ undeclared (first use in this function)
     } else if (klass == rb_cFixnum) {
                         ^~~~~~~~~~
generator.c:861:25: note: each undeclared identifier is reported only once for each function it appears in
generator.c:863:25: error: ‘rb_cBignum’ undeclared (first use in this function)
     } else if (klass == rb_cBignum) {
                         ^~~~~~~~~~
generator.c: At top level:
cc1: warning: unrecognized command line option ‘-Wno-self-assign’
cc1: warning: unrecognized command line option ‘-Wno-constant-logical-operand’
cc1: warning: unrecognized command line option ‘-Wno-parentheses-equality’
make: *** [Makefile:242: generator.o] Error 1

make failed, exit code 2

Gem files will remain installed in /home/gableroux/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/gems/json-1.8.3 for inspection.
Results logged to /home/gableroux/.rbenv/versions/2.4.0/lib/ruby/gems/2.4.0/extensions/x86_64-linux/2.4.0-static/json-1.8.3/gem_make.out

Package can also be installed from the aur tho.

$ sudo aura -A ruby-github-markdown-preview                                             
aura >>= Determining dependencies...
aura >>= Dependency checking failed for these reasons:
The dependency `ruby-github-markdown` could not be found. You may need to search for a package to satisfy it.

At least, building it myself did work in the end.

$ git clone git@github.com:dmarcotte/github-markdown-preview.git
$ cd github-markdown-preview
$ rbenv install 2.4.0
$ rbenv local 2.4.0
$ rbenv local
$ ruby --version                                              
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux]
$ gem --version                      
2.6.8
$ bundle install
$ bundle exec bin/github-markdown-preview readme.md

🌮 🎉 Initial problem isn't really solved but it's ok for me, feel free to close this issue ;)

@dmarcotte
Copy link
Owner

Thanks @GabLeRoux. Glad you got sorted, though it's too bad you hit the bump in the first place. Thanks for your patience, and hope the previews serve you well.

@andyneff
Copy link

I had this problem too, using the rubygem/github-markdown-preview docker.

Not a ruby guy, but it turns out this problem only occurs if there are multiple versions of rb-inotify installed (with my setup at least, and I was using debian:8, ubuntu:16.04, and the rubygem/github-markdown-preview images, and they all had the same issue)

So following the instructions:

BUNDLE_GEMFILE=Gemfile.optional bundle install

On a clean system has a chance of creating this issue. Since rb-inotify may have already been installed as a older version, and running bundle install again, will install the newer version if available.

However,

gem install github-linguist -v 3.3.1 # 3.3.1 is required
gem install rugged -v 0.23.0 # undeclared dependency of linguist

On a clean system will not.

So while this can be solved on a "clean" system, I still don't know the solution on a normal system.

@GabLeRoux
Copy link
Author

@andyneff Did you try using rbenv like I did?

I don't think I can help you much here, I just tried again with the above commands (#45 (comment)) on a new system with the above commands, I had some errors on Macos, see #46, but I managed to get it working again. It installed rb-inotify 0.9.7 correctly.

@andyneff
Copy link

@GabLeRoux rbenv is not available in the docker images by default, so I didn't even try it. I was just trying to add more information to this issue rather than trying to solve it for myself.

If rbenv is similar python's virtualenv it would be consistent with what I was saying. In the rbenv, there will only be one version of rb-inotify, and for some reason having two versions of rb-inotify causes this problem. I would imagine if you had two versions of rb-inotify in your rbenv, you would be back to having the error message again (if rbenv even allows multiple versions of the same library, which apparently gem does allow)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants