此文首发于我的Jekyll博客:zhang0peter的个人博客
早上在本地构建博客时报错如下:
zhang0peter.github.io>jekyll serve
Incremental build: disabled. Enable with --incremental
Generating...
GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
GitHub Metadata: Failed to open TCP connection to api.github.com:443 (No connection could be made because the target machine actively refused it. - connect(2) for "api.github.com" port 443)
GitHub Metadata: Failed to open TCP connection to api.github.com:443 (No connection could be made because the target machine actively refused it. - connect(2) for "api.github.com" port 443)
GitHub Metadata: Failed to open TCP connection to api.github.com:443 (No connection could be made because the target machine actively refused it. - connect(2) for "api.github.com" port 443)
GitHub Metadata: Failed to open TCP connection to api.github.com:443 (No connection could be made because the target machine actively refused it. - connect(2) for "api.github.com" port 443)
GitHub Metadata: An existing connection was forcibly closed by the remote host. - SSL_connect
GitHub Metadata: Failed to open TCP connection to api.github.com:443 (No connection could be made because the target machine actively refused it. - connect(2) for "api.github.com" port 443)
GitHub Metadata: An existing connection was forcibly closed by the remote host. - SSL_connect
GitHub Metadata: An existing connection was forcibly closed by the remote host. - SSL_connect
GitHub Metadata: An existing connection was forcibly closed by the remote host. - SSL_connect
Jekyll Feed: Generating feed for posts
Liquid Exception: undefined method `map' for false:FalseClass Did you mean? tap in /_layouts/post.html
------------------------------------------------
Jekyll 4.0.0 Please append `--trace` to the `serve` command
for any additional information or backtrace.
------------------------------------------------
里面有报错GitHub Metadata: No GitHub API authentication could be found. Some fields may be missing or have incorrect data.
和Failed to open TCP connection to api.github.com:443 (No connection could be made because the target machine actively refused it. - connect(2) for "api.github.com" port 443)
解决方法参考官方文档:github-metadata/authentication.md at master · jekyll/github-metadata
先打开https://github.com/settings/tokens/new
,权限不用选,默认是public repository
生成token后运行:
JEKYLL_GITHUB_TOKEN=your_token jekyll serve
如果是windows用户,可以把变量增加到系统的环境变量中。
如果报错如下:
Incremental build: disabled. Enable with --incremental
Generating...
GitHub Metadata: No internet connection. GitHub metadata may be missing or incorrect.
GitHub Metadata: No internet connection. GitHub metadata may be missing or incorrect.
GitHub Metadata: No internet connection. GitHub metadata may be missing or incorrect.
GitHub Metadata: No internet connection. GitHub metadata may be missing or incorrect.
GitHub Metadata: No internet connection. GitHub metadata may be missing or incorrect.
GitHub Metadata: No internet connection. GitHub metadata may be missing or incorrect.
GitHub Metadata: No internet connection. GitHub metadata may be missing or incorrect.
GitHub Metadata: No internet connection. GitHub metadata may be missing or incorrect.
GitHub Metadata: No internet connection. GitHub metadata may be missing or incorrect.
Jekyll Feed: Generating feed for posts
Liquid Exception: undefined method `map' for false:FalseClass Did you mean? tap in /_layouts/post.html
------------------------------------------------
Jekyll 4.0.0 Please append `--trace` to the `serve` command
for any additional information or backtrace.
------------------------------------------------
那么在_config.yml
中添加github: [metadata]