在 Ubuntu 14.04 上安装 Jekyll
Installing Jekyll on Ubuntu 14.04
我在 Ubuntu 上安装 Jekyll 时遇到了一些问题。以下是我拥有的一些版本:
trevor~$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
trevor~$ gem -v
2.5.1
trevor~$ rvm -v
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
但是,当我尝试安装 Jekyll 时,出现以下错误:
trevor~$ gem install jekyll
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /home/trevor/.rvm/gems/ruby-2.2.4/gems/ffi-1.9.10/ext/ffi_c
/home/trevor/.rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20151229-11854-1czjp2r.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/trevor/.rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/home/trevor/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/trevor/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0'
from /home/trevor/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:556:in `try_link'
from /home/trevor/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:637:in `try_ldflags'
from /home/trevor/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:1780:in `pkg_config'
from extconf.rb:15:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/trevor/.rvm/gems/ruby-2.2.4/extensions/x86_64-linux/2.2.0/ffi-1.9.10/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/trevor/.rvm/gems/ruby-2.2.4/gems/ffi-1.9.10 for inspection.
Results logged to /home/trevor/.rvm/gems/ruby-2.2.4/extensions/x86_64-linux/2.2.0/ffi-1.9.10/gem_make.out
或者如果我使用 sudo:
trevor~$ sudo gem install jekyll
ERROR: Error installing jekyll:
jekyll requires Ruby version >= 2.0.0.
我已经尝试按照其他有类似问题的人的建议安装多个版本的 ruby-dev,但这似乎也无济于事。
trevor~$ sudo apt-get install ruby2.2.4-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ruby2.2.4-dev
E: Couldn't find any package by regex 'ruby2.2.4-dev'
同样的事情发生在 ruby2.0.0-dev
。
运行 sudo apt-get install ruby-dev
似乎安装 1.9.3.4
。无论如何,我仍然 运行 遇到上述相同的问题。
有什么想法吗?
编辑
这是我的 rvm 列表:
trevor~$ rvm list
rvm rubies
ruby-2.0.0-p643 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
=* ruby-2.2.4 [ x86_64 ]
# => - current
# =* - current && default
# * - default
我确实尝试安装了几个不同的版本。这会导致问题吗?
您收到的错误说明了一切错误:安装 jekyll 时出错:jekyll 需要 Ruby 版本 >= 2.0.0。您需要至少为 2.0.0 或更高版本的 Ruby。我总是推荐最新版本,除非您出于特定原因需要不同的版本。
所以你需要做的是编译更新版本的ruby。我推荐最新版本2.3.0。您可以从 ruby-lang.org/en/download. Compiling isn't as hard as everyone says it is, there is a great write up from Compiling Easy HowTo 下载它。编译完成后,您应该能够使用 gem 安装 jekyll 并启动它并 运行。如果您有任何问题或遇到任何错误,请回来,我会尽力帮助您。
I did try installing a couple different versions. Would this cause a
problem?
没有
按照给定的步骤进行操作会有所帮助。
1: gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
2: \curl -sSL https://get.rvm.io | bash
# 安装 RVM (development version)
3: rvm get head
# 确保 RVM 是最新的
4: rvm install ruby
# 将安装最新版本的 ruby
5: rvm list
# 列出安装 rubies 你会得到 RVM
安装的 ruby 版本
6: rvm use < ruby-version >
# 对于实例 ruby-1.9.3-p125
7: gem install jekyll
编辑更新 当你在你的 senerio 中编辑答案时
trevor~$ rvm list
rvm rubies
ruby-2.0.0-p643 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
=* ruby-2.2.4 [ x86_64 ]
rvm use 2.2.1
gem install jekyll
会工作!!!
我在 Ubuntu 上安装 Jekyll 时遇到了一些问题。以下是我拥有的一些版本:
trevor~$ ruby -v
ruby 2.2.4p230 (2015-12-16 revision 53155) [x86_64-linux]
trevor~$ gem -v
2.5.1
trevor~$ rvm -v
rvm 1.26.11 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
但是,当我尝试安装 Jekyll 时,出现以下错误:
trevor~$ gem install jekyll
Building native extensions. This could take a while...
ERROR: Error installing jekyll:
ERROR: Failed to build gem native extension.
current directory: /home/trevor/.rvm/gems/ruby-2.2.4/gems/ffi-1.9.10/ext/ffi_c
/home/trevor/.rvm/rubies/ruby-2.2.4/bin/ruby -r ./siteconf20151229-11854-1czjp2r.rb extconf.rb
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/home/trevor/.rvm/rubies/ruby-2.2.4/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/home/trevor/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /home/trevor/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0'
from /home/trevor/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:556:in `try_link'
from /home/trevor/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:637:in `try_ldflags'
from /home/trevor/.rvm/rubies/ruby-2.2.4/lib/ruby/2.2.0/mkmf.rb:1780:in `pkg_config'
from extconf.rb:15:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/home/trevor/.rvm/gems/ruby-2.2.4/extensions/x86_64-linux/2.2.0/ffi-1.9.10/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /home/trevor/.rvm/gems/ruby-2.2.4/gems/ffi-1.9.10 for inspection.
Results logged to /home/trevor/.rvm/gems/ruby-2.2.4/extensions/x86_64-linux/2.2.0/ffi-1.9.10/gem_make.out
或者如果我使用 sudo:
trevor~$ sudo gem install jekyll
ERROR: Error installing jekyll:
jekyll requires Ruby version >= 2.0.0.
我已经尝试按照其他有类似问题的人的建议安装多个版本的 ruby-dev,但这似乎也无济于事。
trevor~$ sudo apt-get install ruby2.2.4-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package ruby2.2.4-dev
E: Couldn't find any package by regex 'ruby2.2.4-dev'
同样的事情发生在 ruby2.0.0-dev
。
运行 sudo apt-get install ruby-dev
似乎安装 1.9.3.4
。无论如何,我仍然 运行 遇到上述相同的问题。
有什么想法吗?
编辑
这是我的 rvm 列表:
trevor~$ rvm list
rvm rubies
ruby-2.0.0-p643 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
=* ruby-2.2.4 [ x86_64 ]
# => - current
# =* - current && default
# * - default
我确实尝试安装了几个不同的版本。这会导致问题吗?
您收到的错误说明了一切错误:安装 jekyll 时出错:jekyll 需要 Ruby 版本 >= 2.0.0。您需要至少为 2.0.0 或更高版本的 Ruby。我总是推荐最新版本,除非您出于特定原因需要不同的版本。
所以你需要做的是编译更新版本的ruby。我推荐最新版本2.3.0。您可以从 ruby-lang.org/en/download. Compiling isn't as hard as everyone says it is, there is a great write up from Compiling Easy HowTo 下载它。编译完成后,您应该能够使用 gem 安装 jekyll 并启动它并 运行。如果您有任何问题或遇到任何错误,请回来,我会尽力帮助您。
I did try installing a couple different versions. Would this cause a
problem?
没有
按照给定的步骤进行操作会有所帮助。
1: gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
2: \curl -sSL https://get.rvm.io | bash
# 安装 RVM (development version)
3: rvm get head
# 确保 RVM 是最新的
4: rvm install ruby
# 将安装最新版本的 ruby
5: rvm list
# 列出安装 rubies 你会得到 RVM
6: rvm use < ruby-version >
# 对于实例 ruby-1.9.3-p125
7: gem install jekyll
编辑更新 当你在你的 senerio 中编辑答案时
trevor~$ rvm list
rvm rubies
ruby-2.0.0-p643 [ x86_64 ]
ruby-2.2.1 [ x86_64 ]
=* ruby-2.2.4 [ x86_64 ]
rvm use 2.2.1
gem install jekyll
会工作!!!