long-haul
long-haul copied to clipboard
`jekyll serve --livereload` breaks with "undefined method `<<' for #<Http::NativeParser"
Neat theme! Had some trouble getting it working on my site. Here's the issue as replicated in this repo, with no changes except adding webrick
so Jekyll can actually serve[^1]. (I tried to get up and running with gulp like the readme recommends, but I ran into the same issue as #104 so I then started trying to serve directly with Jekyll commands.)
Software versions
- MacOS Monterey v12.3.1
- ruby v3.0.0
- Bundler v2.3.7
- ??? (Any other info I can provide? I'm not a ruby person so I don't know what's up)
Repro steps
- pull down this repo
-
bundle install
-
bundle add webrick
-
bundle exec jekyll serve --livereload
I can open the site at localhost:4000 fine, but when I try to navigate to another page of the site, jekyll serve
breaks with the following:
$ bundle exec jekyll serve --livereload --trace
Configuration file: /Users/maiamccormick/code/long-haul/_config.yml
Source: /Users/maiamccormick/code/long-haul
Destination: /Users/maiamccormick/code/long-haul/_site
Incremental build: disabled. Enable with --incremental
Generating...
done in 1.183 seconds.
Auto-regeneration: enabled for '/Users/maiamccormick/code/long-haul'
LiveReload address: http://127.0.0.1:35729
Server address: http://127.0.0.1:4000
Server running... press ctrl-c to stop.
LiveReload experienced an error. Run with --trace for more information.
LiveReload experienced an error. Run with --trace for more information.
#<Thread:0x00007fc777572df8 /Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve/live_reload_reactor.rb:41 run> terminated with exception (report_on_exception is true):
/Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve/websockets.rb:44:in `dispatch': undefined method `<<' for #<Http::NativeParser:0x00007fc777253898 @method=nil, @path=nil, @version=nil, @headers={}, @body=nil, @state=:request_line, @options={:max_header_length=>10240, :max_headers=>100, :min_tempfile_size=>1048576, :tempfile_class=>Tempfile}> (NoMethodError)
from /Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/gems/em-websocket-0.5.3/lib/em-websocket/connection.rb:79:in `receive_data'
from /Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run_machine'
from /Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run'
from /Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve/live_reload_reactor.rb:44:in `block in start'
bundler: failed to load command: jekyll (/Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/bin/jekyll)
/Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve/websockets.rb:44:in `dispatch': undefined method `<<' for #<Http::NativeParser:0x00007fc777253898 @method=nil, @path=nil, @version=nil, @headers={}, @body=nil, @state=:request_line, @options={:max_header_length=>10240, :max_headers=>100, :min_tempfile_size=>1048576, :tempfile_class=>Tempfile}> (NoMethodError)
from /Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/gems/em-websocket-0.5.3/lib/em-websocket/connection.rb:79:in `receive_data'
from /Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run_machine'
from /Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/gems/eventmachine-1.2.7/lib/eventmachine.rb:195:in `run'
from /Users/maiamccormick/code/long-haul/_vendor/ruby/3.0.0/gems/jekyll-4.2.2/lib/jekyll/commands/serve/live_reload_reactor.rb:44:in `block in start'
I've got no idea what's going on here, and livereload
(or equivalent) is pretty crucial to my workflow. Thoughts?
[^1]: as per the Jekyll quickstart guide, you need to install webrick
for jekyll serve
to work with Ruby 3+
No idea if it's relevant (as I said, I'm not a ruby person) but the diff to my Gemfile.lock
after all the installations above:
Working on fixing this! Sorry about the late reply.
@maiamcc I am having no luck with this issue. I previously used Gulp and Browsersync to do the live reloading but I've since removed that. Unfortunately, your problem persists. I will keep looking but wanted to give an update.
Thanks for looking into it, much appreciated!
Livereload doesn't break anymore. Check the pull request.
Hm I just pulled the latest master
and livereload... just seems to work now, even without #123? So uh, thanks!
Well that's interesting. I'll take a look tomorrow! I have been quite busy so thanks for checking this out @maiamcc and thanks again for your pr @iambozdar