我想构建并使用这个github项目https://github.com/cmedley/terraforming
我正在尝试按照此处https://github.com/cmedley/terraforming#development的说明来构建和运行程序包。
但是,当我运行./script/setup
时,我得到了
Traceback (most recent call last):
2: from /usr/local/bin/bundle:23:in `<main>'
1: from /usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems.rb:302:in `activate_bin_path'
/usr/local/Cellar/ruby/2.6.3/lib/ruby/2.6.0/rubygems.rb:283:in `find_spec_for_exe': can't find gem bundler (>= 0.a) with executable bundle (Gem::GemNotFoundException)
我想念任何明显的东西吗?我没有很多红宝石经验,并且我完全不了解Ruby生态系统。
问题中显示的错误已由Max Pleaner的建议解决。
gem install bundler
但是很快就遇到了第二个问题:
Gem :: Ext :: BuildError:错误:无法构建gem本机扩展。
当前目录:/Users/antkong/Documents/Personal/wd/terraforming-assume-role/bin/ruby/2.3.0/gems/json-2.2.0/ext/json/ext/generator/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r./siteconf20191105-34055-mnnpg3.rb extconf.rb mkmf.rb找不到红宝石的头文件位于/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/include/ruby.h
extconf失败,退出代码1
Gem files will remain installed in /Users/antkong/Documents/Personal/wd/terraforming-assume-role/bin/ruby/2.3.0/gems/json-2.2.0 for inspection. Results logged to /Users/antkong/Documents/Personal/wd/terraforming-assume-role/bin/ruby/2.3.0/extensions/universal-darwin-18/2.3.0/json-2.2.0/gem_make.out An error occurred while installing json (2.2.0), and Bundler cannot continue. Make sure that `gem install json -v '2.2.0' --source 'https://rubygems.org/'` succeeds before bundling. In Gemfile: coveralls was resolved to 0.8.21, which depends on simplecov was resolved to 0.14.1, which depends on json
遵循此答案中的说明的解决方案:https://stackoverflow.com/a/58084238/58129
我复制以下步骤:
sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install
sudo xcodebuild -license accept
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
shareeditflag