我一直试图让Ruby on Rails建立一段时间。我对Ruby没有任何问题,但是随着Rails的转变,事情就变成了南方。我认为在更新到Ruby v2.3.1之后事情就崩溃了。起初是OpenSSL问题。
我使用RVM重新安装了Ruby,当我使用gem install rails
重新安装Rails时,我得到了:
Yiqiaos-MBP:bookstore Richard$ gem install rails
Fetching: rack-1.6.4.gem (100%)
Successfully installed rack-1.6.4
Fetching: concurrent-ruby-1.0.2.gem (100%)
Successfully installed concurrent-ruby-1.0.2
Fetching: sprockets-3.6.0.gem (100%)
Successfully installed sprockets-3.6.0
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.6.gem (100%)
Successfully installed activesupport-4.2.6
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
current directory: /Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/nokogiri-1.6.8/ext/nokogiri
/Users/Richard/.rvm/rubies/ruby-2.3.1/bin/ruby -r ./siteconf20160607-53149-klvpv1.rb extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts ... yes
checking if the C compiler accepts -Wno-error=unused-command-line-argument-hard-error-in-future... no
Building nokogiri using packaged libraries.
*** 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
--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=/Users/Richard/.rvm/rubies/ruby-2.3.1/bin/$(RUBY_BASE_NAME)
--help
--clean
--use-system-libraries
/Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- openssl (LoadError)
from /Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/2.3.0/net/https.rb:23:in `<top (required)>'
from /Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2/mini_portile.rb:3:in `<top (required)>'
from /Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/gems/2.3.0/gems/mini_portile2-2.1.0/lib/mini_portile2.rb:2:in `<top (required)>'
from /Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /Users/Richard/.rvm/rubies/ruby-2.3.1/lib/ruby/site_ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from extconf.rb:468:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/Richard/.rvm/gems/ruby-2.3.1@global/extensions/x86_64-darwin-15/2.3.0/nokogiri-1.6.8/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/Richard/.rvm/gems/ruby-2.3.1@global/gems/nokogiri-1.6.8 for inspection.
Results logged to /Users/Richard/.rvm/gems/ruby-2.3.1@global/extensions/x86_64-darwin-15/2.3.0/nokogiri-1.6.8/gem_make.out
以下是the mkmf.log file,它似乎也没有帮助。
答案 0 :(得分:0)
在使用Mac OS和RVM时,请尝试以下操作:
gem install bundler
brew install rbenv-default-gems
echo "bundler\n" >> ~/.rbenv/default-gems
echo "gem: --no-document\n" >> ~/.gemrc
答案 1 :(得分:0)
使用rvm安装rails,这是在一个地方安装多个rails的最佳方法
http://www.rubyonrailsdoc.com/2016/06/simple-steps-to-install-ruby-on-rails.html