Bundler无法安装commonmarker。

4

我正在尝试设置一个GitHub Pages存储库。我遵循的步骤:

安装bundler

$ gem install bundler

Fetching: bundler-2.0.2.gem (100%)
Successfully installed bundler-2.0.2
Parsing documentation for bundler-2.0.2
Installing ri documentation for bundler-2.0.2
Done installing documentation for bundler after 27 seconds
1 gem installed

好的。

创建Gemfile,指定当前GH版本(3.8.5)的Jekyll

source "https://rubygems.org"

gem "jekyll", "3.8.5"

运行 bundle install

$ bundle install

Fetching gem metadata from https://rubygems.org/...........
Fetching public_suffix 4.0.1
Installing public_suffix 4.0.1
Fetching addressable 2.7.0
Installing addressable 2.7.0
Using bundler 2.0.2
Fetching colorator 1.1.0
Installing colorator 1.1.0
Using concurrent-ruby 1.1.5
Fetching eventmachine 1.2.7 (x64-mingw32)
Installing eventmachine 1.2.7 (x64-mingw32)
Fetching http_parser.rb 0.6.0
Installing http_parser.rb 0.6.0 with native extensions
Fetching em-websocket 0.5.1
Installing em-websocket 0.5.1
Fetching ffi 1.11.2 (x64-mingw32)
Installing ffi 1.11.2 (x64-mingw32)
Fetching forwardable-extended 2.6.0
Installing forwardable-extended 2.6.0
Using i18n 0.9.5
Fetching rb-fsevent 0.10.3
Installing rb-fsevent 0.10.3
Fetching rb-inotify 0.10.0
Installing rb-inotify 0.10.0
Fetching sass-listen 4.0.0
Installing sass-listen 4.0.0
Fetching sass 3.7.4
Installing sass 3.7.4
Fetching jekyll-sass-converter 1.5.2
Installing jekyll-sass-converter 1.5.2
Fetching listen 3.2.0
Installing listen 3.2.0
Fetching jekyll-watch 2.2.1
Installing jekyll-watch 2.2.1
Fetching kramdown 1.17.0
Installing kramdown 1.17.0
Fetching liquid 4.0.3
Installing liquid 4.0.3
Fetching mercenary 0.3.6
Installing mercenary 0.3.6
Fetching pathutil 0.16.2
Installing pathutil 0.16.2
Fetching rouge 3.13.0
Installing rouge 3.13.0
Fetching safe_yaml 1.0.5
Installing safe_yaml 1.0.5
Fetching jekyll 3.8.5
Installing jekyll 3.8.5
Bundle complete! 1 Gemfile dependency, 25 gems now installed.
Use `bundle info [gemname]` to see where a bundled gem is installed.
Post-install message from sass:

Ruby Sass has reached end-of-life and should no longer be used.

* If you use Sass as a command-line tool, we recommend using Dart Sass, the new
  primary implementation: https://sass-lang.com/install

* If you use Sass as a plug-in for a Ruby web framework, we recommend using the
  sassc gem: https://github.com/sass/sassc-ruby#readme

* For more details, please refer to the Sass blog:
  https://sass-lang.com/blog/posts/7828841

一些有关过时软件包的警告,但是很不错。

创建新网站(指南步骤7)

$ bundler exec jekyll new .

重写Gemfile为:
source "https://rubygems.org"

# Hello! This is where you manage which Jekyll version is used to run.
# When you want to use a different version, change it below, save the
# file and run `bundle install`. Run Jekyll with `bundle exec`, like so:
#
#     bundle exec jekyll serve
#
# This will help ensure the proper Jekyll version is running.
# Happy Jekylling!
gem "jekyll", "~> 3.8.5"

# This is the default theme for new Jekyll sites. You may change this to anything you like.
gem "minima", "~> 2.0"

# If you want to use GitHub Pages, remove the "gem "jekyll"" above and
# uncomment the line below. To upgrade, run `bundle update github-pages`.
# gem "github-pages", group: :jekyll_plugins

# If you have any plugins, put them here!
group :jekyll_plugins do
  gem "jekyll-feed", "~> 0.6"
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem "tzinfo-data", platforms: [:mingw, :mswin, :x64_mingw, :jruby]

# Performance-booster for watching directories on Windows
gem "wdm", "~> 0.1.0" if Gem.win_platform?

并输出:

Running bundle install in C:/Projects/coding-for-smarties...
  Bundler: C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/resolver.rb:287:in `block in verify_gemfile_dependencies_are_found!': Could not find gem 'minima (~> 2.0) x64-mingw32' in any of the gem sources listed in your Gemfile. (Bundler::GemNotFound)
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/resolver.rb:255:in `each'
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/resolver.rb:255:in `verify_gemfile_dependencies_are_found!'
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/resolver.rb:49:in `start'
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/resolver.rb:22:in `resolve'
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/definition.rb:258:in `resolve'
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/definition.rb:170:in `specs'
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/definition.rb:237:in `specs_for'
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/definition.rb:226:in `requested_specs'
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:108:in `block in definition_method'
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/runtime.rb:20:in `setup'
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler.rb:107:in `setup'
  Bundler: from C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/bundler-2.0.2/lib/bundler/setup.rb:20:in `<top (required)>'
  Bundler: from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'
  Bundler: from C:/Ruby24-x64/lib/ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require'

错误:在Gemfile中列出的任何gem源中都找不到'minima(〜> 2.0)x64-mingw32'宝石。

可能没有问题,因为我想要另一个主题。 因此,我更新了它,并进行了指南步骤8和9建议的更改。

再次尝试安装

$ bundle install

Fetching gem metadata from https://rubygems.org/...........
Fetching gem metadata from https://rubygems.org/.
Resolving dependencies......................
Using concurrent-ruby 1.1.5
Using i18n 0.9.5
Fetching minitest 5.13.0
Installing minitest 5.13.0
Fetching thread_safe 0.3.6
Installing thread_safe 0.3.6
Fetching tzinfo 1.2.5
Installing tzinfo 1.2.5
Fetching activesupport 4.2.10
Installing activesupport 4.2.10
Fetching public_suffix 2.0.5 (was 4.0.1)
Installing public_suffix 2.0.5 (was 4.0.1)
Using addressable 2.7.0
Using bundler 2.0.2
Fetching coffee-script-source 1.11.1
Installing coffee-script-source 1.11.1
Fetching execjs 2.7.0
Installing execjs 2.7.0
Fetching coffee-script 2.4.1
Installing coffee-script 2.4.1
Using colorator 1.1.0
Fetching ruby-enum 0.7.2
Installing ruby-enum 0.7.2
Fetching commonmarker 0.17.13
Installing commonmarker 0.17.13 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/commonmarker-0.17.13/ext/commonmarker
C:/Ruby24-x64/bin/ruby.exe -r ./siteconf20191114-10956-3hyma7.rb extconf.rb
creating Makefile

current directory:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/commonmarker-0.17.13/ext/commonmarker
make "DESTDIR=" clean

current directory:
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/commonmarker-0.17.13/ext/commonmarker
make "DESTDIR="
generating commonmarker-x64-mingw32.def
compiling arena.c
compiling autolink.c
compiling blocks.c
compiling buffer.c
compiling cmark.c
compiling cmark_ctype.c
compiling commonmark.c
compiling commonmarker.c
In file included from C:/Ruby24-x64/include/ruby-2.4.0/ruby.h:33,
                 from commonmarker.h:9,
                 from commonmarker.c:1:
C:/Ruby24-x64/include/ruby-2.4.0/ruby/ruby.h:631:1: warning: 'const' attribute
on function returning 'void' [-Wattributes]
  631 | CONSTFUNC(void rb_secure_update(VALUE));
      | ^~~~~~~~~
In file included from C:/Ruby24-x64/include/ruby-2.4.0/ruby/ruby.h:2012,
                 from C:/Ruby24-x64/include/ruby-2.4.0/ruby.h:33,
                 from commonmarker.h:9,
                 from commonmarker.c:1:
C:/Ruby24-x64/include/ruby-2.4.0/ruby/intern.h:257:1: warning: 'const' attribute
on function returning 'void' [-Wattributes]
  257 | CONSTFUNC(void rb_error_untrusted(VALUE));
      | ^~~~~~~~~
C:/Ruby24-x64/include/ruby-2.4.0/ruby/intern.h:259:1: warning: 'const' attribute
on function returning 'void' [-Wattributes]
  259 | CONSTFUNC(void rb_check_trusted(VALUE));
      | ^~~~~~~~~
In file included from houdini.h:9,
                 from commonmarker.c:3:
config.h:8: warning: "HAVE_STDBOOL_H" redefined
    8 | #define HAVE_STDBOOL_H
      |
In file included from C:/Ruby24-x64/include/ruby-2.4.0/ruby/ruby.h:24,
                 from C:/Ruby24-x64/include/ruby-2.4.0/ruby.h:33,
                 from commonmarker.h:9,
                 from commonmarker.c:1:
C:/Ruby24-x64/include/ruby-2.4.0/x64-mingw32/ruby/config.h:30: note: this is the
location of the previous definition
   30 | #define HAVE_STDBOOL_H 1
      |
compiling core-extensions.c
compiling ext_scanners.c
compiling footnotes.c
compiling houdini_href_e.c
compiling houdini_html_e.c
compiling houdini_html_u.c
compiling html.c
compiling inlines.c
compiling iterator.c
compiling latex.c
compiling linked_list.c
compiling man.c
compiling map.c
compiling node.c
compiling plaintext.c
compiling plugin.c
compiling references.c
compiling registry.c
compiling render.c
compiling scanners.c
compiling strikethrough.c
compiling syntax_extension.c
compiling table.c
compiling tagfilter.c
compiling utf8.c
compiling xml.c
linking shared-object commonmarker/commonmarker.so
C:/Ruby24-x64/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/9.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe:
strikethrough.o:strikethrough.c:(.text+0x2ba): undefined reference to
`__memset_chk'
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:259: commonmarker.so] Error 1

make failed, exit code 2

Gem files will remain installed in
C:/Ruby24-x64/lib/ruby/gems/2.4.0/gems/commonmarker-0.17.13 for inspection.
Results logged to
C:/Ruby24-x64/lib/ruby/gems/2.4.0/extensions/x64-mingw32/2.4.0/commonmarker-0.17.13/gem_make.out

An error occurred while installing commonmarker (0.17.13), and Bundler
cannot continue.
Make sure that `gem install commonmarker -v '0.17.13' --source
'https://rubygems.org/'` succeeds before bundling.

In Gemfile:
  github-pages was resolved to 187, which depends on
    jekyll-commonmark-ghpages was resolved to 0.1.5, which depends on
      jekyll-commonmark was resolved to 1.3.1, which depends on
        commonmarker

错误 安装 commonmarker (0.17.13) 时发生了错误,Bundler 无法继续。

我无法解决这个问题。最好的办法是删除所有 gem 包并重新启动,但这只会让我回到原点。

1个回答

4
另一种选择是使用 Docker 在 Windows 上运行 Jekyll(来自 James Sturtevant)。这将充分利用 Docker 镜像 jekyll/jekyll(参见其 README)。
export JEKYLL_VERSION=3.8
docker run --rm \
  --volume="$PWD:/srv/jekyll" \
  -it jekyll/jekyll:$JEKYLL_VERSION \
  jekyll build

而且你不需要安装Ruby或者烦恼于缺少依赖项。


我应该学会阅读。我花了3个小时尝试从Ubuntu开始构建一个Dockerfile。最后,在博客文章中的一个简单命令解决了问题。 - undefined

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接