4

我在我的技术博客中使用octopress。我从官方 octopress repo 更新了我的 octopress 代码,运行时出现类似错误rake generate

 |1.9.3-p194| home in ~/Documents/work/git/muratcorlu.github.com
± |source ✓| → rake generate
## Generating Site with Jekyll
directory source/stylesheets/ 
   create source/stylesheets/screen.css 
Configuration from /Users/muratcorlu/Documents/work/git/muratcorlu.github.com/_config.yml
/Users/muratcorlu/Documents/work/git/muratcorlu.github.com/plugins/category_generator.rb:109: warning: regexp has invalid interval
/Users/muratcorlu/Documents/work/git/muratcorlu.github.com/plugins/category_generator.rb:109: warning: regexp has `}' without escape
/Users/muratcorlu/Documents/work/git/muratcorlu.github.com/plugins/category_generator.rb:146: warning: regexp has invalid interval
/Users/muratcorlu/Documents/work/git/muratcorlu.github.com/plugins/category_generator.rb:146: warning: regexp has `}' without escape
/Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/../lib/jekyll/site.rb:76:in `require': /Users/muratcorlu/Documents/work/git/muratcorlu.github.com/plugins/image_tag.rb:27: undefined (?...) sequence: /(?<class>\S.*\s+)?(?<src>(?:https?:\/\/|\/|\S+\/)\S+)(?:\s+(?<width>\d+))?(?:\s+(?<height>\d+))?(?<title>\s+.+)?/ (SyntaxError)
/Users/muratcorlu/Documents/work/git/muratcorlu.github.com/plugins/image_tag.rb:29: undefined (?...) sequence: /(?:"|')(?<title>[^"']+)?(?:"|')\s+(?:"|')(?<alt>[^"']+)?(?:"|')/
    from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/../lib/jekyll/site.rb:76:in `setup'
    from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/../lib/jekyll/site.rb:75:in `each'
    from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/../lib/jekyll/site.rb:75:in `setup'
    from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/../lib/jekyll/site.rb:30:in `initialize'
    from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/jekyll:224:in `new'
    from /Library/Ruby/Gems/1.8/gems/jekyll-0.11.2/bin/jekyll:224
    from /usr/bin/jekyll:23:in `load'
    from /usr/bin/jekyll:23

问题是什么?

4

1 回答 1

1

首先,我在 irb 中尝试了 RegEx:

$ irb
irb(main):001:0> /(?:"|')(?<title>[^"']+)?(?:"|')\s+(?:"|')(?<alt>[^"']+)?(?:"|')/
=> /(?:"|')(?<title>[^"']+)?(?:"|')\s+(?:"|')(?<alt>[^"']+)?(?:"|')/
irb(main):002:0> 

我没有收到任何错误,但后来我发现我在服务器上的默认 ruby​​ 版本是 1.8.7。

我从 rvm 中选择了 ruby​​-1.9.3-p551 并将其激活。

我做了以下事情:

rvm use ruby-1.9.3-p551
bundle install
bundle exec rake generate

这为我解决了错误。

于 2014-12-15T06:07:17.677 回答