读取文件错误
问题描述:
gem install jekyll bundler
jekyll new my-awesome-site
cd my-awesome-site
bundle install
bundle exec jekyll serve
然后,当我浏览到http://localhost:4000有一个空白页面,并在命令提示符以下错误:
Error reading file C:/Ruby23/lib/ruby/gems/2.3.0/gems/minima-1.2.0/_layouts/default.html: No such file or directory @ rb_sysopen - /Ruby23/lib/ruby/gems/2.3.0/gems/minima-1.2.0/_layouts/default.html
Error reading file C:/Ruby23/lib/ruby/gems/2.3.0/gems/minima-1.2.0/_layouts/page.html: No such file or directory @ rb_sysopen - /Ruby23/lib/ruby/gems/2.3.0/gems/minima-1.2.0/_layouts/page.html
Error reading file C:/Ruby23/lib/ruby/gems/2.3.0/gems/minima-1.2.0/_layouts/post.html: No such file or directory @ rb_sysopen - /Ruby23/lib/ruby/gems/2.3.0/gems/minima-1.2.0/_layouts/post.html
这是因为我在分区D:
中使用Jekyll,而Ruby安装在分区C:
中。事实上,如果我将所有项目安装在一个分区中,则不会出现错误,但我更愿意将所有项目都保存在分区D:
中。我相信问题在rb_sysopen
。
任何解决方案?谢谢。
这是我Gemfile.lock
的一部分:
PLATFORMS
- x86-mingw32
DEPENDENCIES
- jekyll (= 3.2.1)
- minima
RUBY VERSION
- ruby 2.3.1p112
BUNDLED WITH
- 1.13.2
答
我找到了一个解决方案,以生成网站,而不会遇到错误:只需复制_includes
,_layouts
,_sass
从主题C:\Ruby23\lib\ruby\gems\2.3.0\gems\minima-1.2.0
的安装目录到项目目录,即D:\www\my-awesome-site
。
Jekyll将首先检查项目目录中的主题文件。
当然这只是一个解决方法。