Sou novo em Ruby/Jekyll, mas estou tentando instalar o Jekyll localmente na minha máquina Windows e criar um site com um tema baixado. Estou com muita dificuldade para fazê-lo funcionar. O tema que estou tentando usar é o tema Contrast . Os passos que segui são os seguintes:
- Seguindo as instruções , instalei o Ruby primeiro usando o instalador Ruby aqui (escolhendo a versão Ruby+Devkit 3.3.7-1 [x64] ). Ao final da instalação, executei a opção ridk install e instalei a instalação base do MSYS2 e o conjunto de ferramentas de desenvolvimento MSYS2 e MINGW .
- Em um prompt de comando, execute
gem install jekyll bundler
, o que resulta no seguinte:
>bundler -v
Bundler version 2.6.7
>gem -v
3.5.22
>jekyll -v
jekyll 4.4.1
- Baixei o tema Contrast como um arquivo zip e o extraí. O resultado são os seguintes arquivos:
myuser@mymachine MINGW64 ~/contrast-master
$ ls
_config.yml _includes/ _posts/ 404.html assets/ Gemfile.lock README.md
_data/ _layouts/ _sass/ archive.html Gemfile index.html UNLICENSE.txt
- Naveguei até o diretório local do tema com um terminal de comando e executei o
bundler install
, que instalou uma série de gems necessárias:
C:\Users\myuser\contrast-master>bundler install
Fetching gem metadata from https://rubygems.org/...........
Resolving dependencies...
Fetching rexml 3.4.1
Fetching rouge 3.30.0
Fetching unicode-display_width 1.8.0
Fetching sassc 2.4.0
Installing rexml 3.4.1
Installing unicode-display_width 1.8.0
Installing rouge 3.30.0
Fetching terminal-table 2.0.0
Installing sassc 2.4.0 with native extensions
Installing terminal-table 2.0.0
Fetching jekyll-sass-converter 2.2.0
Installing jekyll-sass-converter 2.2.0
Fetching jekyll 4.2.2
Installing jekyll 4.2.2
Fetching jekyll-feed 0.17.0
Installing jekyll-feed 0.17.0
Bundle complete! 3 Gemfile dependencies, 30 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
- Tentei construir o site jekyll usando
bundle exec jekyll build
, mas falhou com uma série de mensagens:
C:\Users\myuser\contrast-master>bundle exec jekyll build
C:/Ruby33-x64/bin/jekyll:25: warning: csv was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add csv to your Gemfile or gemspec to silence this warning.
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb:22: warning: base64 was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add base64 to your Gemfile or gemspec to silence this warning.
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/liquid-4.0.4/lib/liquid.rb:72: warning: bigdecimal was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add bigdecimal to your Gemfile or gemspec to silence this warning.
------------------------------------------------
Jekyll 4.2.2 Please append `--trace` to the `build` command
for any additional information or backtrace.
------------------------------------------------
C:/Ruby33-x64/lib/ruby/3.3.0/logger.rb:384:in `level': undefined method `[]' for nil (NoMethodError)
@level_override[Fiber.current] || @level
^^^^^^^^^^^^^^^
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/log_adapter.rb:45:in `adjust_verbosity'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:27:in `process'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `each'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.2.2/exe/jekyll:15:in `<top (required)>'
from C:/Ruby33-x64/bin/jekyll:25:in `load'
from C:/Ruby33-x64/bin/jekyll:25:in `<main>'
Alguém pode me ajudar a ver por que isso não está acontecendo e me ajudar a consertar?
[Observação: quero executá-lo localmente porque quero A) trabalhar offline no site e poder ter visualizações regulares no navegador da minha máquina local e B) ter acesso aos arquivos na pasta _site gerados pelo Jekyll para enviá-los diretamente para um serviço de hospedagem na web, em vez de ter o site criado pelo mecanismo Jekyll no Github Pages, Cloudflare Pages, etc.]
EDITAR
Depois de tentar anexar o arquivo gem com uma versão mais recente do jekyll, conforme sugerido na resposta de @lmtaq abaixo, agora recebo outro erro:
$ bundler exec jekyll build
C:/Ruby33-x64/bin/jekyll:25: warning: csv was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add csv to your Gemfile or gemspec to silence this warning.
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/safe_yaml-1.0.5/lib/safe_yaml/load.rb:22: warning: base64 was loaded from the standard library, but will no longer be part of the default gems starting from Ruby 3.4.0.
You can add base64 to your Gemfile or gemspec to silence this warning.
To use retry middleware with Faraday v2.0+, install `faraday-retry` gem
Configuration file: C:/Users/tjb/Desktop/Web Development/contrast-master/_config.yml
Source: C:/Users/tjb/Desktop/Web Development/contrast-master
Destination: C:/Users/tjb/Desktop/Web Development/contrast-master/_site
Incremental build: disabled. Enable with --incremental
Generating...
Jekyll Feed: Generating feed for posts
Deprecation Warning [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
More info and automated migrator: https://sass-lang.com/d/import
╷
1 │ @import index, font, basic, layout, classes
│ ^^^^^
╵
C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:9 root stylesheet
Deprecation Warning [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
More info and automated migrator: https://sass-lang.com/d/import
╷
1 │ @import index, font, basic, layout, classes
│ ^^^^
╵
C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:16 root stylesheet
Deprecation Warning [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
More info and automated migrator: https://sass-lang.com/d/import
╷
1 │ @import index, font, basic, layout, classes
│ ^^^^^
╵
C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:22 root stylesheet
Deprecation Warning [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
More info and automated migrator: https://sass-lang.com/d/import
╷
1 │ @import index, font, basic, layout, classes
│ ^^^^^^
╵
C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:29 root stylesheet
Deprecation Warning [import]: Sass @import rules are deprecated and will be removed in Dart Sass 3.0.0.
More info and automated migrator: https://sass-lang.com/d/import
╷
1 │ @import index, font, basic, layout, classes
│ ^^^^^^^
╵
C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:37 root stylesheet
Error: Expected newline.
╷
8 │ padding: 1.75em calc(40% - 17em)
│ ^
╵
C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\index.sass 8:37 @import
C:\Users\tjb\Desktop\Web Development\contrast-master\assets\css\frame.sass 1:9 root stylesheet
Conversion error: Jekyll::Converters::Sass encountered an error while converting 'assets/css/frame.sass':
Expected newline.
------------------------------------------------
Jekyll 4.3.3 Please append `--trace` to the `build` command
for any additional information or backtrace.
------------------------------------------------
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-sass-converter-3.1.0/lib/jekyll/converters/scss.rb:181:in `rescue in convert': Expected newline. (Jekyll::Converters::Scss::SyntaxError)
raise SyntaxError, e.message
^^^^^^^^^^^^^^^^^^^^^^
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-sass-converter-3.1.0/lib/jekyll/converters/scss.rb:162:in `convert'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:105:in `block in convert'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `each'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `reduce'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `convert'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:84:in `render_document'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:63:in `run'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:572:in `render_regenerated'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:564:in `block in render_pages'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:563:in `each'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:563:in `render_pages'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:211:in `render'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:80:in `process'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:28:in `process_site'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:65:in `build'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:36:in `process'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `each'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/exe/jekyll:15:in `<top (required)>'
from C:/Ruby33-x64/bin/jekyll:25:in `load'
from C:/Ruby33-x64/bin/jekyll:25:in `<main>'
C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/sass-embedded-1.86.3-x64-mingw-ucrt/lib/sass/compiler/host.rb:86:in `compile_request': Expected newline. (Sass::CompileError)
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/sass-embedded-1.86.3-x64-mingw-ucrt/lib/sass/compiler.rb:171:in `compile_string'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/sass-embedded-1.86.3-x64-mingw-ucrt/lib/sass/embedded.rb:37:in `compile_string'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-sass-converter-3.1.0/lib/jekyll/converters/scss.rb:163:in `convert'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:105:in `block in convert'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `each'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `reduce'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:104:in `convert'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:84:in `render_document'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/renderer.rb:63:in `run'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:572:in `render_regenerated'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:564:in `block in render_pages'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:563:in `each'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:563:in `render_pages'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:211:in `render'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/site.rb:80:in `process'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:28:in `process_site'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:65:in `build'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:36:in `process'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `block in process_with_graceful_fail'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `each'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/command.rb:91:in `process_with_graceful_fail'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/lib/jekyll/commands/build.rb:18:in `block (2 levels) in init_with_program'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `block in execute'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `each'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/command.rb:221:in `execute'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary/program.rb:44:in `go'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/mercenary-0.4.0/lib/mercenary.rb:21:in `program'
from C:/Ruby33-x64/lib/ruby/gems/3.3.0/gems/jekyll-4.3.3/exe/jekyll:15:in `<top (required)>'
from C:/Ruby33-x64/bin/jekyll:25:in `load'
from C:/Ruby33-x64/bin/jekyll:25:in `<main>'
Este é um bug conhecido ao trabalhar com Ruby >= 3.3 e Jekyll < 4.3.3, causado por um problema de compatibilidade com o Logger. Foi corrigido no Jekyll 4.3.3. Veja as notas de lançamento aqui .
Observe que, mesmo que você tenha uma versão mais recente do Jekyll instalada em sua máquina (conforme indicado quando você executou
jekyll -v
), as dependências do seu projeto mostram que ele está usando o Jekyll 4.2.2 (indicado quando você executoubundle install
).Para corrigir esse problema, atualize a dependência do jekyll dentro do contexto do projeto. Se você puder atualizá-lo para a versão mais recente (4.4.1 no momento em que esta resposta foi escrita), esta é a maneira recomendada de resolver o problema:
Alternativamente, se houver algum motivo específico impedindo você de atualizar o Jekyll para a versão mais recente, certifique-se de atualizá-lo pelo menos para a versão 4.3.3. Para fazer isso, atualize seu Gemfile para especificar isso:
E corra
bundle install
.