我该怎么办,依赖项有问题吗?我该如何解决?我在卡塔琳娜上。
我反复收到此错误,并且已经在查找目录..不存在。
sudo bundle update
Password:
Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies.......
Bundler found conflicting requirements for the Ruby
version:
In Gemfile:
github-pages was resolved to 1, which depends on
Ruby (~> 1.9.3)
jekyll-feed (~> 0.12) was resolved to 0.13.0, which
depends on
Ruby (>= 2.3.0)
Bundler could not find compatible versions for gem
"commonmarker":
In Gemfile:
commonmarker (~> 0.21.0)
github-pages was resolved to 203, which depends on
jekyll-commonmark-ghpages (= 0.1.6) was resolved
to 0.1.6, which depends on
commonmarker (~> 0.17.6)
➜ blog git:(gh-pages) ✗ sudo gem install commonmarker
Building native extensions. This could take a while...
ERROR: Error installing commonmarker:
ERROR: Failed to build gem native extension.
current directory: /Library/Ruby/Gems/2.6.0/gems/commonmarker-0.21.0/ext/commonmarker
/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 ./siteconf20200903-9124-19bmbh8.rb extconf.rb
creating Makefile
current directory: /Library/Ruby/Gems/2.6.0/gems/commonmarker-0.21.0/ext/commonmarker
make "DESTDIR=" clean
current directory: /Library/Ruby/Gems/2.6.0/gems/commonmarker-0.21.0/ext/commonmarker
make "DESTDIR="
make: *** No rule to make target `/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h', needed by `arena.o'. Stop.
make failed, exit code 2
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/commonmarker-0.21.0 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/commonmarker-0.21.0/gem_make.out
答案 0 :(得分:12)
山姆的评论是正确的。 XCode 的 ruby 框架已损坏。一种解决方法是建立一个符号链接:
cd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
ln -sf universal-darwin20 universal-darwin19
通过这个,我能够成功构建所有原生扩展。
注意:您应该根据您本地的 Xcode SDK 安装更改您的路径段 MacOSX11.1.sdk
。
答案 1 :(得分:1)
我在使用其他宝石时遇到了同样的问题;我发现了
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin19/ruby/config.h
不存在,但是
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/universal-darwin20/ruby/config.h
存在-即universal-darwin20
而不是universal-darwin19
。
如果我使用较新版本的Ruby运行安装命令,则它可以正常工作。
对于不同的设置,确切的执行方法将有所不同。我使用的是rbenv,所以在安装命令之前先运行rbenv local 2.6.6
。
您可以阅读有关运行多个Ruby版本here的更多信息,也可以只运行一个Ruby版本,但尝试将其升级到较新的版本(例如,brew upgrade ruby
,如果您使用的是Homebrew)。
答案 2 :(得分:-1)
cd 路径就像你的日志错误 /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.1.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
复制并重命名文件夹副本 universal-darwin20
到 universal-darwin19
现在可以使用了。
您可以尝试更高版本的 ruby 或 rails。对它的 gem 支持