繁体   English   中英

“捆绑安装失败”在灌输 nokogiri (1.10.9) 时发生错误,并且 Bundler 无法在 Cloud9 Ubuntu 操作系统上运行的 CS50 IDE 上继续

[英]“bundle install fails” an error occurred while instilling nokogiri (1.10.9), and Bundler cannot continue on CS50 IDE running on Cloud9 Ubuntu OS

当我跑步时

bundle install

此错误显示了问题所在

依赖 tzinfo-data (>= 0) 将不会被 Bundler 安装的任何平台使用。 Bundler 正在为 ruby 安装,但依赖项仅适用于 x86-mingw32、x86-mswin32、x64-mingw32、java。 要将这些平台添加到捆绑包中,请运行bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java

Fetching gem metadata from http://rubygems.org/............
Fetching gem metadata from http://rubygems.org/.
Resolving dependencies.....
Using rake 13.0.1
Using concurrent-ruby 1.1.6
Using i18n 1.8.2
Using minitest 5.14.1
Using thread_safe 0.3.6
Using tzinfo 1.2.7
Using activesupport 5.0.7.2
Using builder 3.2.4
Using erubis 2.7.0
Using mini_portile2 2.4.0
Fetching nokogiri 1.10.9
Installing nokogiri 1.10.9 with native extensions

***Gem::Ext::BuildError: ERROR: Failed to build gem native extension.***

    current directory: /home/ubuntu/.gem/gems/nokogiri-1.10.9/ext/nokogiri
/usr/bin/ruby2.5 -r ./siteconf20200523-4947-1vc8i4.rb extconf.rb
checking if the C compiler accepts -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow... *** 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=/usr/bin/$(RUBY_BASE_NAME)2.5
        --help
        --clean
/usr/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /usr/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile'
        from /usr/lib/ruby/2.5.0/mkmf.rb:521:in `with_werror'
        from /usr/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile'
        from extconf.rb:138:in `nokogiri_try_compile'
        from extconf.rb:162:in `block in add_cflags'
        from /usr/lib/ruby/2.5.0/mkmf.rb:632:in `with_cflags'
        from extconf.rb:161:in `add_cflags'
        from extconf.rb:416:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/ubuntu/.gem/extensions/x86_64-linux/2.5.0/nokogiri-1.10.9/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/ubuntu/.gem/gems/nokogiri-1.10.9 for inspection.
Results logged to /home/ubuntu/.gem/extensions/x86_64-linux/2.5.0/nokogiri-1.10.9/gem_make.out

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

In Gemfile:
  rails was resolved to 5.0.7.2, which depends on
    actioncable was resolved to 5.0.7.2, which depends on
      actionpack was resolved to 5.0.7.2, which depends on
        actionview was resolved to 5.0.7.2, which depends on
          rails-dom-testing was resolved to 2.0.3, which depends on
            nokogiri

我试过gem install nokogiri这个错误显示

Building native extensions. This could take a while...
ERROR:  Error installing nokogiri:
        ERROR: Failed to build gem native extension.

    current directory: /home/ubuntu/.gem/gems/nokogiri-1.10.9/ext/nokogiri
/usr/bin/ruby2.5 -r ./siteconf20200523-7078-1i1qsv1.rb extconf.rb
checking if the C compiler accepts -ggdb3 -O0 -std=c11 -Wall -Werror -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unused-variable -Wshadow... *** 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=/usr/bin/$(RUBY_BASE_NAME)2.5
        --help
        --clean
/usr/lib/ruby/2.5.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
        from /usr/lib/ruby/2.5.0/mkmf.rb:574:in `block in try_compile'
        from /usr/lib/ruby/2.5.0/mkmf.rb:521:in `with_werror'
        from /usr/lib/ruby/2.5.0/mkmf.rb:574:in `try_compile'
        from extconf.rb:138:in `nokogiri_try_compile'
        from extconf.rb:162:in `block in add_cflags'
        from /usr/lib/ruby/2.5.0/mkmf.rb:632:in `with_cflags'
        from extconf.rb:161:in `add_cflags'
        from extconf.rb:416:in `<main>'

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /home/ubuntu/.gem/extensions/x86_64-linux/2.5.0/nokogiri-1.10.9/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /home/ubuntu/.gem/gems/nokogiri-1.10.9 for inspection.
Results logged to /home/ubuntu/.gem/extensions/x86_64-linux/2.5.0/nokogiri-1.10.9/gem_make.out

编辑

我使用sudo gem install nokogiri解决了这个问题

将来可能值得考虑采用不同的方法,因为通过 sudo 安装 gem 可能会出现问题(下面的链接)。

考虑使用 package 管理器 (rbenv/RVM)

不使用系统 Ruby

不要使用 Sudo 安装 gem

暂无
暂无

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

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