首页 > 解决方案 > 在框架“ruby”中没有找到头文件“config.h”?

问题描述

我最近买了一台新机器,并决定创建一个新的 rails 应用程序。我正在使用 rbenv。

当我运行时,rails new一切都开始创建,但没有完成,而是给了我通知说

Your user account isn't allowed to install to the system RubyGems.
  You can cancel this installation and run:

      bundle config set --local path 'vendor/bundle'
      bundle install

  to install the gems into ./vendor/bundle/, or you can enter your password
  and install the bundled gems to RubyGems using sudo.

所以我然后取消了安装并运行了这两个命令。我跑的时候没有问题bundle config set --local path 'vendor/bundle',但是当我跑的时候,我bundle install'得到了一个新的错误说明:

Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/Users/username/Desktop/testAppHere/vendor/bundle/ruby/2.6.0/gems/racc-1.6.0/ext/racc/cparse
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r
./siteconf20211108-45990-wfqxs3.rb extconf.rb
checking for rb_block_call()... *** 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.6/usr/bin/$(RUBY_BASE_NAME)
{lots of log files I don't think are needed}
To see why this extension failed to compile, please check the mkmf.log which can
be found here:

/Users/name/Desktop/testAppHere/vendor/bundle/ruby/2.6.0/extensions/universal-darwin-19/2.6.0/racc-1.6.0/mkmf.log

所以我去了那个文件,感觉不是很有帮助,除了我在那里看到的一行

note: did not find header 'config.h' in framework 'ruby' (loaded from '/Library/Developer/CommandLineTools/SDKs/MacOSX10.15.sdk/System/Library/Frameworks')

有谁知道我在这里做错了什么?我有点想在几个项目上编码,但在这里被阻止了

标签: ruby-on-railsrubyrubygemsconfigrbenv

解决方案


推荐阅读