【问题标题】:Jekyll 3.0 run on localhost:4000 errorJekyll 3.0 在 localhost:4000 错误上运行
【发布时间】:2016-04-09 15:05:23
【问题描述】:

最近,我将我的jekyll服务器从2.5升级到3.0,但是出现了一个问题:

我在 gitpage 上渲染我的页面非常成功,但是当我在本地 jekyll 服务器上渲染它时,出现错误

我每个帖子的路由都是/category/YYYY/MM/DD/postName.html(分类是中文)

在 git 页面上没问题

但是当我使用本地主机服务器时,当我点击这些帖子锚点时,它显示找不到这个 html 文件,并重定向到 404.html

在本地主播的href上,例如http://localhost:4000/%E6%8A%80%E6%9C%AF/2016/04/04/array-function.html

在 git 页面上,href 是 http://numerhero.github.io/%E6%8A%80%E6%9C%AF/2016/04/04/array-function.html

这是我的 gitpage 地址,没问题:http://numerhero.github.io

【问题讨论】:

    标签: jekyll


    【解决方案1】:

    试试这个:

    1. 安装捆绑器gem install bundler

    2. 导航到项目的根目录cd path/to/project

    3. 运行bundle init(将创建Gemfile

    4. 编辑您的 Gemfile:

      source 'https://rubygems.org'
      gem 'github-pages' 
      
    5. 运行bundle install

    6. 运行bundle update(偶尔)

    7. 使用 Bundler 服务 Jekyll:bundle exec jekyll serve

    完成!

    您的问题必须与您的本地依赖项有关,该依赖项必须与 GitHub Pages 不同。使用依赖管理器Bundler,您将确保在本地安装了github-pagesall it's dependencies

    不时运行bundle update 以确保您安装了最新版本。

    在此处阅读有关将 Jekyll 2 升级到 3 的更多信息:

    http://blog.virtuacreative.com.br/upgrade-jekyll-2-to-3-gh-pages.html

    【讨论】:

    • 我尝试了你的方法,但是当我运行 bundle install 时,它显示了这个错误:Undefined local variable or method 'gigem' for Gemfile. Bundler cannot continue
    • 我的错!可怕的错别字!不是gigem 'github-pages',只是gem 'github-pages'!我真的很抱歉!我更新了答案。请在您的 Gemfile 上修复它,然后重试!让我知道进展如何,是吗?
    • 是的,我再次尝试您的方法,将 gigem 更改为 gem,但它给了我一个新错误:Gem::RemoteFetcher::FetchError: Errno::ECONNRESET: An existing connection was forcibly closed by the remote host. - SSL_connect (https://rubygems.org/gems/terminal-table-1.5.2.gem)An error occurred while installing RedCloth (4.2.9), and Bundler cannot continue
    • 嗯.. 我猜可能是您没有在本地安装 OpenSSL。在 Gemfile 中,将协议从 https 更改为 http。但我不是 100% 确定这是最后一个错误的根源。别担心,我很乐意帮助你:)
    • 好的,那我该怎么办?
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2018-11-10
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多