gpt4 book ai didi

ruby-on-rails - 尝试使用 Jekyll rake 命令时出错

转载 作者:太空宇宙 更新时间:2023-11-03 16:05:07 24 4
gpt4 key购买 nike

我正在尝试学习 Jekyll,如果我输入以下命令

rake post title="Hello World"

我收到以下错误:

rake post title="My First Post"
/usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:296:in `to_specs': Could not find 'rake' (>= 0) among 11 total gem(s) (Gem::LoadError)
from /usr/lib/ruby/site_ruby/1.8/rubygems/dependency.rb:307:in `to_spec'
from /usr/lib/ruby/site_ruby/1.8/rubygems/core_ext/kernel_gem.rb:47:in `gem'
from /usr/bin/rake:18

这是我的环境:

gem env
RubyGems Environment:
- RUBYGEMS VERSION: 2.0.3
- RUBY VERSION: 1.8.7 (2011-06-30 patchlevel 352) [x86_64-linux]
- INSTALLATION DIRECTORY: /usr/lib64/ruby/gems/1.8
- RUBY EXECUTABLE: /usr/bin/ruby
- EXECUTABLE DIRECTORY: /usr/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-linux
- GEM PATHS:
- /usr/lib64/ruby/gems/1.8
- /home/jsmith/.gem/ruby/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- https://rubygems.org/

最佳答案

首先,为了简化事情,您的 Jekyll 应用程序应该使用 bundler*。 cd 到您的应用并运行:

$ bundle init

这将创建一个 Gemfile。在那个 Gemfile 中添加 jekyll:

# Gemfile
source 'https://rubygems.org'
gem 'jekyll'

然后运行 ​​bundle install,这将安装 jekyll 及其所有依赖项:

$ bundle install

然后预先用bundle exec运行rake,如下所示:

$ bundle exec rake post title="Hello World"

这样做是使用添加到 Gemfile(与您当前项目关联的 gem 列表)的 rake 版本。

* 取自 http://matthodan.com/2012/10/27/how-to-create-a-blog-with-jekyll.html 的说明

关于ruby-on-rails - 尝试使用 Jekyll rake 命令时出错,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15573153/

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