![](/img/trans.png)
[英]Travis-CI is giving me an error when I am trying to build my site. What is wrong if the bundler matches with the gemfile.lock file?
[英]travis-ci : error during the build (No such file or directory)
我在嘗試為jekyll應用程序在travis-ci上測試構建時遇到問題。 其中一個插件會生成一個json,其中包含我的應用程序可用於搜索工具的信息。
build命令在我的計算機上工作正常:
bundle exec jekyll build --source octopress
Witch將信息索引到我的內置目錄(_site)中的search.json文件中。
但是它在Travis-ci上失敗了,在Heroku上失敗了。
writting search.json to /home/travis/build/alain-andre/mon_site/_site
jekyll 2.5.3 | Error: No such file or directory - /home/travis/build/alain-andre/mon_site/_site/search.json
有人可以幫忙嗎?
好的,我找到了解決方案。
我必須將search.json
添加到site.keep_files
。
首先要做的是在Jekyll模塊內創建一個Jekyll :: StaticFile 。
class SearchJson < Jekyll::StaticFile
def write(dest)
begin
super(dest)
rescue
end
true
end
end
然后,在創建文件后,將其添加到site.static_files
如下所示:
# Keep the file from being cleaned by Jekyll
Jekyll::SearchJson.new(site, site.dest, "/", filename)
site.keep_files << filename
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.