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

jekyll serve --livereload breaks with "undefined method `<<' for #<Http::NativeParser" #108

Open
maiamcc opened this issue Sep 30, 2022 · 7 comments

Comments

@maiamcc
Copy link
Contributor

maiamcc commented Sep 30, 2022

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 serve1. (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?

Footnotes

  1. as per the Jekyll quickstart guide, you need to install webrick for jekyll serve to work with Ruby 3+

@maiamcc
Copy link
Contributor Author

maiamcc commented Sep 30, 2022

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:
Screen Shot 2022-09-29 at 11 34 04 PM

@brianmaierjr
Copy link
Owner

Working on fixing this! Sorry about the late reply.

@brianmaierjr
Copy link
Owner

@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.

@maiamcc
Copy link
Contributor Author

maiamcc commented Feb 12, 2023

Thanks for looking into it, much appreciated!

@yabozdar
Copy link

Livereload doesn't break anymore. Check the pull request.

@maiamcc
Copy link
Contributor Author

maiamcc commented Jul 2, 2023

Hm I just pulled the latest master and livereload... just seems to work now, even without #123? So uh, thanks!

@brianmaierjr
Copy link
Owner

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

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