gpt4 book ai didi

ruby-on-rails - 如何在 Ubuntu 14.04 上安装 Rails?

转载 作者:行者123 更新时间:2023-12-04 19:16:51 25 4
gpt4 key购买 nike

我是关于 Ubuntu 的新手。
Chromebook Pixel LS(2015)

Ubuntu 14.04 amd64 by crouton.unity

我安装了 rvm 1.26.11 & ruby​​ 2.3.0p0

如何安装 Rails?

我尝试了一些东西。但是我对Linux一无所知...

(trusty)snowcat@localhost:~$ gem install rails --version 4.2.5 --no-ri --no-rdocFetching: rack-1.6.4.gem (100%)
Successfully installed rack-1.6.4
Fetching: concurrent-ruby-1.0.0.gem (100%)
Successfully installed concurrent-ruby-1.0.0
Fetching: sprockets-3.5.2.gem (100%)
Successfully installed sprockets-3.5.2
Fetching: thread_safe-0.3.5.gem (100%)
Successfully installed thread_safe-0.3.5
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.7.0.gem (100%)
Successfully installed i18n-0.7.0
Fetching: activesupport-4.2.5.gem (100%)
Successfully installed activesupport-4.2.5
Fetching: mini_portile2-2.0.0.gem (100%)
Successfully installed mini_portile2-2.0.0
Fetching: nokogiri-1.6.7.1.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

current directory: /home/snowcat/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.6.7.1/ext/nokogiri
/home/snowcat/.rvm/rubies/ruby-2.3.0/bin/ruby -r ./siteconf20160108-3517-11wk1wh.rb extconf.rb
checking if the C compiler accepts ... *** 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/snowcat/.rvm/rubies/ruby-2.3.0/bin/$(RUBY_BASE_NAME)
--help
--clean
/home/snowcat/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.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/snowcat/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:571:in `block in try_compile'
from /home/snowcat/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:522:in `with_werror'
from /home/snowcat/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:571:in `try_compile'
from extconf.rb:80:in `nokogiri_try_compile'
from extconf.rb:87:in `block in add_cflags'
from /home/snowcat/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/mkmf.rb:629:in `with_cflags'
from extconf.rb:86:in `add_cflags'
from extconf.rb:336:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

/home/snowcat/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.7.1/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/snowcat/.rvm/gems/ruby-2.3.0/gems/nokogiri-1.6.7.1 for inspection.
Results logged to /home/snowcat/.rvm/gems/ruby-2.3.0/extensions/x86_64-linux/2.3.0/nokogiri-1.6.7.1/gem_make.out

最佳答案

nokogiri想要构建为 C 扩展,这意味着您需要 C 语言的构建工具。尝试

sudo apt-get install build-essential

然后继续安装 rails 。

关于ruby-on-rails - 如何在 Ubuntu 14.04 上安装 Rails?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34660628/

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