【问题标题】:jekyll serve throws an error on Herokujekyll serve 在 Heroku 上引发错误
【发布时间】:2023-03-24 15:03:01
【问题描述】:

我正在尝试使用 jekyll serve 运行我的 jekyll 站点,但它失败了。以下是我尝试过的命令的变体列表:

bundle exec jekyll serve --port $PORT --host 0.0.0.0

bundle exec jekyll serve

jekyll serve --port $PORT --host 0.0.0.0

jekyll serve

对于上述所有命令,它都会失败,并在我的 heroku 应用程序上显示以下错误消息:

杰基尔 3.7.0 |错误:文件存在@syserr_fail2_in - /app/_site/bin/erb

请你帮忙。我的问题与这篇文章有点不同: link

我尝试过以下版本的 ruby​​:

  1. 2.1.9
  2. 2.2.9
  3. 2.3.5
  4. 2.4.3

在下面查看我的配置:


config.ru

require 'rack/jekyll'
run Rack::Jekyll.new

Rakefile

namespace :assets do
  task :precompile do
    sh 'bundle exec jekyll build'
  end
end

过程文件

web: bundle exec jekyll serve --port $PORT --host 0.0.0.0

宝石文件

source 'https://rubygems.org'
gemspec
ruby '2.4.3'
gem 'jekyll'
gem 'rack-jekyll'
gem 'rake'

_config.yml

title: title
description: description
google_analytics:
theme: jekyll-theme-dinky
jekyll_auth:
      ssl: true
gems: ['kramdown']
exclude: ['config.ru', 'Gemfile', 'Gemfile.lock', 'vendor', 'Procfile', 
'Rakefile']

我在本地使用相同版本的 ruby​​、rubygems、bunlder 和 jekyll 运行我的网站,没有这个问题。

如果我使用 puma 运行它,它可以工作,但我的永久链接不起作用。我想使用 jekyll serve 来运行它

请有人帮忙。


这里是jekyll serve --trace的输出:

/app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:1371:in `symlink': File exists @ sys_fail2 - /app/_site/bin/erb (Errno::EEXIST)
    from /app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:1371:in `copy'
    from /app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:472:in `block in copy_entry'
    from /app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:1498:in `call'
    from /app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:1498:in `wrap_traverse'
    from /app/vendor/ruby-2.2.9/lib/ruby/2.2.0/fileutils.rb:469:in `copy_entry'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/static_file.rb:154:in `copy_file'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/static_file.rb:100:in `write'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:208:in `block in write'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:329:in `block (2 levels) in each_site_file'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:328:in `each'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:328:in `block in each_site_file'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:327:in `each'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:327:in `each_site_file'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:207:in `write'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/site.rb:75:in `process'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/command.rb:28:in `process_site'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/build.rb:65:in `build'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/build.rb:36:in `process'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/serve.rb:93:in `block in start'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/serve.rb:93:in `each'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/serve.rb:93:in `start'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/lib/jekyll/commands/serve.rb:75:in `block (2 levels) in init_with_program'
    from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `call'
    from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `block in execute'
    from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `each'
    from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary/command.rb:220:in `execute'
    from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary/program.rb:42:in `go'
    from /app/vendor/bundle/ruby/2.2.0/gems/mercenary-0.3.6/lib/mercenary.rb:19:in `program'
    from /app/vendor/bundle/ruby/2.2.0/gems/jekyll-3.7.0/exe/jekyll:15:in `<top (required)>'
    from /app/vendor/bundle/bin/jekyll:17:in `load'
    from /app/vendor/bundle/bin/jekyll:17:in `<main>'

【问题讨论】:

  • exclude:_config.yml 中的配置设置是什么?
  • 嗨@ashmaroli,我已经更新了上面的内容以包含我的_config.yml 文件
  • 好的.. 能否请您发布运行bundle exec jekyll serve --trace..时输出的整个错误消息。
  • 嗨@ashmaroli 我已经添加了上面输出的内容
  • @ClintonShaneWright 你找到解决方案了吗?

标签: heroku jekyll


【解决方案1】:

错误似乎是因为符号链接的static_file_site/bin/erb 已经写入之后尝试写入_site/bin/erb..

想知道为什么它在本地构建时不会导致类似的错误.. app/bin 在静态网站中没有任何作用。所以你可以告诉 Jekyll 忽略该目录,方法是将其添加到你的 exclude: 数组中。

【讨论】:

    【解决方案2】:

    在尝试了十几件事之后,我拍摄了一份关于将 Jekyll 降级到早期版本的传单。瞧!抱歉 - 我没有进行任何根本原因分析,也没有尝试让它与当前版本一起使用。

    我的 Gemfile 中的 Jekyll 条目:

    gem 'jekyll', '3.0.0'

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2017-10-26
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-03-23
      • 1970-01-01
      相关资源
      最近更新 更多