gpt4 book ai didi

ruby - 在 Windows 本地主机上运行 Jekyll 的问题

转载 作者:可可西里 更新时间:2023-11-01 11:34:10 24 4
gpt4 key购买 nike

首先,我是 Ruby 新手,使用本地主机。

我正在使用:Windows 8 Pro,Ruby 安装到 C:\Ruby200,Ruby Devkit 安装到 C:\RubyDEVconfig。 yml 也已正确配置到正确的目录。

gem 规范似乎存储在 C:\username\.gem

最后,Jekyll gem 根据命令提示符完美安装。 bin 的正确 PATH 也已设置。

jekyll --server 正在运行据说会转到“localhost:4000”,但似乎没有完美设置。它最初在尝试访问 / 时给我一个 Forbidden 错误,但现在它似乎根本不想加载。

我查阅了一些教程。

我没有安装任何额外的依赖项,据我所知,这些依赖项似乎是可选的,以替换 Textile 等。

我不知道我做错了什么。

非常感谢任何帮助。

切换到 1.9.3 后的最新错误

C:\RubyDEV>jekyll --server
WARNING: Could not read configuration. Using defaults (and options).
No such file or directory - C:/RubyDEV/_config.yml
Building site: C:/RubyDEV -> C:/RubyDEV/_site
C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1371:in `initialize': Permission denied -
C:/RubyDEV/_site/bin/bashbug (Errno::EACCES)
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1371:in `open'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1371:in `block in copy_file'

from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1370:in `open'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1370:in `copy_file'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:477:in `copy_file'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:396:in `block in cp'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1515:in `block in fu_each_sr
c_dest'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1531:in `fu_each_src_dest0'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:1513:in `fu_each_src_dest'
from C:/Ruby193/lib/ruby/1.9.1/fileutils.rb:395:in `cp'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.12.1/lib/jekyll/static
_file.rb:58:in `write'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.12.1/lib/jekyll/site.r
b:256:in `block in write'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.12.1/lib/jekyll/site.r
b:255:in `each'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.12.1/lib/jekyll/site.r
b:255:in `write'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.12.1/lib/jekyll/site.r
b:43:in `process'
from C:/Ruby193/lib/ruby/gems/1.9.1/gems/jekyll-0.12.1/bin/jekyll:264:in
`<top (required)>'
from C:/Ruby193/bin/jekyll:23:in `load'
from C:/Ruby193/bin/jekyll:23:in `<main>'

C:\RubyDEV>

最佳答案

很多 gem 还没有为 Ruby 2.0 准备好,特别是因为 Windows 需要预编译的二进制文件。

RubyInstaller 2.0.0-p0 announcement 中提到了这一点在 RubyInstaller 列表中,为了答案的完整性而在这里重现它:

  • Existing pre-compiled gems are not Ruby 2.0 compatible

Ruby 2.0 introduces ABI breakage which means compiled C extensions with previous 1.9.3 will work with Ruby 2.0.

DO NOT install Ruby 2.0 on top of existing Ruby 1.9.3, or try to use compiled extensions with it.

You will be required to force compilation of those gems:

gem install <name> --platform=ruby 

This will require you have the extra dependencies required for that gem to compile. Look at the gem documentation for the requirements.

要解决当前情况,您需要卸载 yajl-ruby 并强制安装:

gem install yajl-ruby --platform=ruby

考虑到 RDiscount 等其他 gem 在此版本(目前)上无法正常工作,如果您改用 Ruby 1.9.3 可能会更好。

希望对您有所帮助。

关于ruby - 在 Windows 本地主机上运行 Jekyll 的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15727911/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com