I have a fresh install of Ruby2.7.0 and Jekyll following Jekyll tutorial (first part via RubyInstaller). I’m working on Visual Code Studio to create my blog on Github Pages using Jekyll static generator.
When I do a bundle exec jekyll serve it works fine. But when I add the option --livereload I get errors each first save of a file.
So, when starting the server :
bundle exec jekyll serve --trace --livereload
Configuration file: C:/Github/myrepo2/_config.yml
Theme Config file: C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-theme-chirpy-3.2.2/_config.yml
Source: C:/Github/myrepo2
Destination: C:/Github/myrepo2/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 6.728 seconds.
Auto-regeneration: enabled for 'C:/Github/myrepo2'
LiveReload address: http://127.0.0.1:35729
Server address: http://127.0.0.1:4000/myrepo2/
Server running... press ctrl-c to stop.
And when saving a file after modification to see the update on my browser :
Regenerating: 1 file(s) changed at 2021-03-14 07:08:47
_posts/2021-02-25-welcome.md
LiveReload: Browser connected
#<Thread:0x00000000082ea6f0 C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve/live_reload_reactor.rb:41 run> terminated with exception (report_on_exception is true):
Traceback (most recent call last):
7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve/live_reload_reactor.rb:44:in `block in start'
6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/eventmachine.rb:196:in `run'
5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:144:in `run_machine'
4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:547:in `run'
3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:547:in `loop'
2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:553:in `block in run'
1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:595:in `crank_selectables'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:595:in `select': An operation was attempted on something that is not a socket. (Errno::ENOTSOCK)
7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve/live_reload_reactor.rb:44:in `block in start'
6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/eventmachine.rb:196:in `run'
5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:144:in `run_machine'
4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:562:in `run'
3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:559:in `ensure in run'
2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:559:in `each'
1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:559:in `block in run'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:559:in `close': Bad file descriptor (Errno::EBADF)
Traceback (most recent call last):
7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve/live_reload_reactor.rb:44:in `block in start'
6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/eventmachine.rb:196:in `run'
5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:144:in `run_machine'
4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:547:in `run'
3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:547:in `loop'
2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:553:in `block in run'
1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:595:in `crank_selectables'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:595:in `select': An operation was attempted on something that is not a socket. (Errno::ENOTSOCK)
7: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/jekyll-4.2.0/lib/jekyll/commands/serve/live_reload_reactor.rb:44:in `block in start'
6: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/eventmachine.rb:196:in `run'
5: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:144:in `run_machine'
4: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:562:in `run'
3: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:559:in `ensure in run'
2: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:559:in `each'
1: from C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:559:in `block in run'
C:/Ruby27-x64/lib/ruby/gems/2.7.0/gems/eventmachine-1.2.7-x64-mingw32/lib/em/pure_ruby.rb:559:in `close': Bad file descriptor (Errno::EBADF)
This wdm 0.1.1 installed (almost at the end of the list)
And on my Gemfile, I already have this gem 'wdm', '~> 0.1.1', :install_if => Gem.win_platform?
What are you using for the console? powershell? normal command prompt? linux shell thing? I use the command prompt and powershell with no problems - via VS code.
Thank you for the link.
I have already read it and not found a solution with it. From what I understood he was using an old version of Ruby, and by applying the new one it have solved the issue.
Also, I forgot to specified that to have the livereload option working I have applied this patch
Before this patch, livereload option was stopping while generating the server.
I’m using the terminal of VS Code and it’s automatically selecting the language. I saw PowerShell while writting the command, then “cmd” and finally Ruby.
In case this may help others, I successfully worked around the issue by launching a PowerShell window with admin rights, along with editing one file in ruby’s native libs, and it worked. Before, I tried to use the Ruby interpreter and the win Git Bash, none worked. I have a clean Ruby 2.7 install on Windows 10.
/EDIT: ah no, in fact only the first build works, but then the livereload fails, same error.
Finally I’ve found an alternative, simply use in a PowerShell:
jekyll serve --watch
This worked whereas livereload always failed (even after uninstalling eventmanager and reinstalling it). It’s not like a livereload but it’s better than nothing.
Hi @Irq3000, I have exactly the same issue than you have. When I use jekyll serve --watch it doesn’t have the automatic reload of the page, it this normal?
No it doesn’t autoreload the page, you have to hit F5 to refresh everytime you make a change, but at least it automatically rebuild in the background.
@rdyar I tested all commands with livereload, they do not work, the livereload functionality is broken on my Windows 10 machine for some reason (and I’m not a Ruby coder, I started afresh), the same errors as stated above appear for me.