简体   繁体   English

无法安装 Commonmarker gem(jekyll 需要)macos

[英]Commonmarker gem cannot be installed (needed for jekyll) macos

what do I have to do, is there a problem with dependencies?我该怎么办,依赖项有问题吗? How do I fix those?我该如何解决这些问题? I am on catalina.我在卡塔利娜。

I repeatedly get this error and have already looked for the directory.. doesn't exist.我反复收到此错误并且已经查找目录..不存在。

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

Sam's comments are correct.山姆的评论是正确的。 XCode's ruby framework is broken. XCode 的 ruby​​ 框架已损坏。 A workaround is to make a symbolic link:解决方法是创建符号链接:

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

With this, I was able to successfully build all the native extensions.有了这个,我能够成功构建所有本机扩展。

Note: You should change your path segment MacOSX11.1.sdk according to your local Xcode SDK installation.注意:您应该根据您本地的 Xcode SDK 安装更改您的路径段MacOSX11.1.sdk

I had this same problem with a different gem;我在使用不同的 gem 时遇到了同样的问题; I found that我找到

/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

didn't exist, but不存在,但

/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

did exist - ie universal-darwin20 rather than universal-darwin19 .确实存在 - 即universal-darwin20而不是universal-darwin19

If I ran my install command using a newer version of Ruby, it worked.如果我使用较新版本的 Ruby 运行我的安装命令,它会起作用。

Exactly how to do this will differ for different setups.对于不同的设置,具体如何执行此操作会有所不同。 I was using rbenv , so ran rbenv local 2.6.6 before the install command.我正在使用rbenv ,所以在安装命令之前运行rbenv local 2.6.6

You can read more about running multiple Ruby versions here , or you could just run a single Ruby version but try upgrading it to a newer version (eg brew upgrade ruby if you're using Homebrew).您可以在此处阅读有关运行多个 Ruby 版本的更多信息,或者您可以只运行一个 Ruby 版本但尝试将其升级到更新的版本(例如,如果您使用的是 Homebrew,则brew upgrade ruby )。

For those on MacOS without XCode and only command line tools installed:对于那些在 MacOS 上没有 XCode并且只安装了命令行工具的人:

cd /Library/Developer/CommandLineTools/SDKs/MacOSX11.3.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0
sudo ln -sf universal-darwin20 universal-darwin21

...tweaking the MacOSX11.3.sdk segment in the path if need be. ...如果需要,调整路径中的MacOSX11.3.sdk段。

I also needed a symbolic link, but my ruby installation was in a different location ( /Library/Developer/... vs /Applications/Xcode.app/... ), for that reason, the commands I used to fix my local github-pages installation were:我还需要一个符号链接,但是我的 ruby​​ 安装在不同的位置( /Library/Developer/... vs /Applications/Xcode.app/... ),因此,我用来修复本地的命令github-pages 安装为:

cd /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/include/ruby-2.6.0/

sudo ln -sf universal-darwin19 universal-darwin20

cd path like your log error /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 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

and dupplicate and rename folder copy universal-darwin20 to universal-darwin19并复制并重命名文件夹 copy universal-darwin20universal-darwin19

now it is working.现在它正在工作。
You can try higher version ruby or rails.您可以尝试更高版本的 ruby​​ 或 rails。 gem support for it对它的宝石支持

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM