ruby - 运行命令 bundler install 时出错
问题描述
我是 bundle 和 ruby 的新手,我刚刚安装了 bundle 2.2.17 和 ruby 3.0.1。当我运行命令bundle install
时,出现以下错误。追溯错误后,我仍然无法理解错误并确定出现此错误的原因。如果有人可以指导我如何开始解决这个问题,那将非常有帮助。以下是我运行命令后得到的输出消息:
Resolving dependencies....
Using concurrent-ruby 1.1.8
Using minitest 5.14.4
Using thread_safe 0.3.6
Using zeitwerk 2.4.2
Using public_suffix 4.0.6
Using bundler 2.2.17
Using colorator 1.1.0
Using coffee-script-source 1.11.1
Using execjs 2.8.1
Following files may not be writable, so sudo is needed:
/Library/Ruby/Gems/2.6.0
/Library/Ruby/Gems/2.6.0/build_info
/Library/Ruby/Gems/2.6.0/cache
/Library/Ruby/Gems/2.6.0/doc
/Library/Ruby/Gems/2.6.0/extensions
/Library/Ruby/Gems/2.6.0/gems
/Library/Ruby/Gems/2.6.0/specifications
Using faraday-excon 1.1.0
Using faraday-net_http 1.0.1
Using multipart-post 2.1.1
Using forwardable-extended 2.6.0
Using gemoji 3.0.1
Using rb-fsevent 0.11.0
Using rexml 3.2.5
Using mercenary 0.3.6
Using rouge 3.26.0
Using safe_yaml 1.0.5
Fetching http_parser.rb 0.6.0
Fetching eventmachine 1.2.7
Using liquid 4.0.3
Using jekyll-paginate 1.1.0
Using rubyzip 2.3.0
Using jekyll-swiss 1.0.0
Using unicode-display_width 1.7.0
Using tzinfo 1.2.9
Using i18n 0.9.5
Using addressable 2.7.0
Using pathutil 0.16.2
Using coffee-script 2.4.1
Using kramdown 2.3.1
Using terminal-table 1.8.0
Using activesupport 6.0.3.7
Using ruby-enum 0.9.0
Using jekyll-coffeescript 1.1.1
Using kramdown-parser-gfm 1.1.0
Fetching ffi 1.15.0
Fetching unf_ext 0.0.7.7
Fetching racc 1.5.2
Using faraday-net_http_persistent 1.1.0
Using ruby2_keywords 0.0.4
Fetching commonmarker 0.17.13
Using faraday 1.4.1
Using sawyer 0.8.2
Using octokit 4.21.0
Using jekyll-gist 1.5.0
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.
Password:
Installing http_parser.rb 0.6.0 with native extensions
Installing eventmachine 1.2.7 with native extensions
Installing commonmarker 0.17.13 with native extensions
Installing racc 1.5.2 with native extensions
Installing unf_ext 0.0.7.7 with native extensions
Installing ffi 1.15.0 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/private/var/folders/v5/f0xx2vq95039ds03fshsy_980000gn/T/bundler20210520-20868-8wnof7commonmarker-0.17.13/gems/commonmarker-0.17.13/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
./siteconf20210520-20868-8zcp2h.rb extconf.rb
creating Makefile
current directory:
/private/var/folders/v5/f0xx2vq95039ds03fshsy_980000gn/T/bundler20210520-20868-8wnof7commonmarker-0.17.13/gems/commonmarker-0.17.13/ext/commonmarker
make "DESTDIR=" clean
current directory:
/private/var/folders/v5/f0xx2vq95039ds03fshsy_980000gn/T/bundler20210520-20868-8wnof7commonmarker-0.17.13/gems/commonmarker-0.17.13/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
/var/folders/v5/f0xx2vq95039ds03fshsy_980000gn/T/bundler20210520-20868-8wnof7commonmarker-0.17.13/gems/commonmarker-0.17.13
for inspection.
Results logged to
/var/folders/v5/f0xx2vq95039ds03fshsy_980000gn/T/bundler20210520-20868-8wnof7commonmarker-0.17.13/extensions/universal-darwin-19/2.6.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 214, which depends on
jekyll-commonmark-ghpages was resolved to 0.1.6, which depends on
jekyll-commonmark was resolved to 1.3.1, which depends on
commonmarker
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory:
/private/var/folders/v5/f0xx2vq95039ds03fshsy_980000gn/T/bundler20210520-20868-vi8pkcunf_ext-0.0.7.7/gems/unf_ext-0.0.7.7/ext/unf_ext
/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
./siteconf20210520-20868-i4vcac.rb extconf.rb
checking for -lstdc++... *** 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)
--with-static-libstdc++
--without-static-libstdc++
--with-stdc++lib
--without-stdc++lib
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in
`try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:546:in
`block in try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/tmpdir.rb:93:in
`mktmpdir'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:543:in
`try_link0'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:570:in
`try_link'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:789:in
`try_func'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1016:in
`block in have_library'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in
`block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in
`block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
`open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in
`block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in
`open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in
`postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in
`checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1011:in
`have_library'
from extconf.rb:6:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/var/folders/v5/f0xx2vq95039ds03fshsy_980000gn/T/bundler20210520-20868-vi8pkcunf_ext-0.0.7.7/extensions/universal-darwin-19/2.6.0/unf_ext-0.0.7.7/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in
/var/folders/v5/f0xx2vq95039ds03fshsy_980000gn/T/bundler20210520-20868-vi8pkcunf_ext-0.0.7.7/gems/unf_ext-0.0.7.7
for inspection.
Results logged to
/var/folders/v5/f0xx2vq95039ds03fshsy_980000gn/T/bundler20210520-20868-vi8pkcunf_ext-0.0.7.7/extensions/universal-darwin-19/2.6.0/unf_ext-0.0.7.7/gem_make.out
An error occurred while installing unf_ext (0.0.7.7), and Bundler cannot continue.
Make sure that `gem install unf_ext -v '0.0.7.7' --source 'https://rubygems.org/'` succeeds
before bundling.
In Gemfile:
github-pages was resolved to 214, which depends on
github-pages-health-check was resolved to 1.17.0, which depends on
dnsruby was resolved to 1.61.5, which depends on
simpleidn was resolved to 0.2.1, which depends on
unf was resolved to 0.1.4, which depends on
unf_ext
解决方案
此错误可能与: Rails: Your user account is not allowed to install to the system RubyGems
之后尝试执行 gem install commonmarker -v '0.17.13' --source 'https://rubygems.org/'` 在捆绑之前成功。检查是否将安装此 gem。
推荐阅读
- android - 如何在 Kotlin 中使用编程设置约束
- python - None 使用 asyncio 阻止“while True”
- python - Scrapy爬虫在第二次运行后不起作用
- javascript - 多次渲染?
- flutter - useScrollController 的安全使用?(颤振钩子)
- python - ValueError: int() 以 10 为基数的无效文字:'' (Tkinter)
- python - 为什么 `/=` 会引发错误而不是 `x = x / y` 与只读 numpy 数组?
- python - CSV 中的数据框
- .net - 如何在 .NET mvc 应用程序的 URL 中关闭自动路由
- regex - Ubuntu 16 sed 不能使用括号