gpt4 book ai didi

ruby-on-rails - 安装 Rails 时出错 : Failed to build Gem native extension, 'lack of libraries or headers'

转载 作者:数据小太阳 更新时间:2023-10-29 07:55:44 24 4
gpt4 key购买 nike

我一直在尝试让 Rails 正常工作,但无论我做什么,都会出现此错误。到目前为止,我已经尝试更新所有内容,重新安装自制软件,并重新安装 ruby​​。然而 RVM 不会安装

sudo gem install rails

Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby 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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--help
--clean
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:500:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from extconf.rb:77:in `block in add_cflags'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:599:in `with_cflags'
from extconf.rb:76:in `add_cflags'
from extconf.rb:323:in `<main>'


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.5 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/nokogiri-1.6.5/ext/nokogiri/gem_make.out

最佳答案

这里有错误

“你必须先安装开发工具。”

Incase,在尝试更新包时,您会收到错误 “You have to install development tools first.” on OSX,

如果你已经安装了Xcode,你仍然可以通过终端手动安装开发工具:

 xcode-select --install

您的问题将得到解决。

关于ruby-on-rails - 安装 Rails 时出错 : Failed to build Gem native extension, 'lack of libraries or headers',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27637785/

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