Open namiwang opened 7 months ago
Github Dependabot sent me multiple security alerts regarding rack
version used in jekyll-admin
. rack
should be upgraded to at least 2.2.8.1
. Upgrading sinatra
to 4 will solve the problem.
@namiwang unfortunately your fix (adding rackup
gem) doesn't let me save new pages inside the admin because of the following error:
NoMethodError - undefined method `rewind' for #<Rackup::Handler::WEBrick::Input
I managed to get both admin and saving files working by downgrading sinatra:
gem "sinatra", ">= 3", "< 4"
Edit: issue mentioned here too https://github.com/jekyll/jekyll-admin/issues/709
I've had similar but not identical issues today after forking from an old jekyll theme, switching on dependabot, and it asking for some massive version leaps in both rack
and jekyll-admin
.
jekyll 3.9.5 | Error: uninitialized constant Rack::Handler
/usr/local/lib/ruby/gems/3.3.0/gems/jekyll-admin-0.11.1/lib/jekyll/commands/serve.rb:23:in `jekyll_admin_monkey_patch': uninitialized constant Rack::Handler (NameError)
@server.mount "/admin", Rack::Handler::WEBrick, JekyllAdmin::StaticServer
^^^^^^^^^
from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-admin-0.11.1/lib/jekyll/commands/serve.rb:15:in `start_up_webrick'
from /usr/local/lib/ruby/gems/3.3.0/gems/jekyll-3.9.5/lib/jekyll/commands/serve.rb:104:in `process'
...
Thanks @yuanworks : after trying various other fix suggestions from around the internet, downgrading sinatra to 3.x (3.2.0 specifically) did the trick for me.
I am not normally a ruby person and a little lost in this dependency mire, but commenting in case this helps anyone else out.
Here's the answer (most likely).
You need to add the rackup
gem to your dependencies in order to be compatible with rack v3.
gem "rackup"
@yuanworks You would also need to replace your line that looks like this:
Rack::Handler::WEBrick.run server
with a line that looks like this:
Rackup::Server.start app: server
where server
is something like:
server = Rack::Builder.new do
# ...
end
Note: it will still run WEBrick
.
After upgrading
sinatra
(whichjekyll-admin
depends on) to 4.0, got the following error when staring serverThe root cause is
sinatra
4 dropped support forrack
2refs:
A workaround is to add
gem "rackup"
toGemfile
.A simple fix would be limiting
spec.add_dependency "sinatra", ">= 1.4", "< 4.0"
ingemspec
, or addingrackup
as a direct dependency.