0

我在本地设置项目时遇到问题。我正在尝试运行我的 Rails 服务器,但在捆绑安装 libxml-ruby gem 以使其启动和运行时遇到了麻烦。任何帮助将不胜感激。

当我尝试运行 rails s 以使服务器运行时。

我收到此错误:

Could not find libxml-ruby-3.1.0 in any of the sources
Run bundle install to install missing gems. 

然后,当我捆绑安装时,出现此错误:


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

current directory: /Users/stefanosugbit/.rvm/gems/ruby-2.5.0/gems/libxml-ruby-3.1.0/ext/libxml
/Users/stefanosugbit/.rvm/rubies/ruby-2.5.0/bin/ruby -I /Users/stefanosugbit/.rvm/rubies/ruby-2.5.0/lib/ruby/site_ruby/2.5.0 -r ./siteconf20191011-12959-rqd4ud.rb extconf.rb
/Users/stefanosugbit/.rvm/rubies/ruby-2.5.0/bin/ruby: warning: shebang line ending with \r may cause problems
checking for libxml/xmlversion.h in /opt/include/libxml2,/opt/local/include/libxml2,/usr/local/include/libxml2,/usr/include/libxml2... no
*** 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
--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=/Users/stefanosugbit/.rvm/rubies/ruby-2.5.0/bin/$(RUBY_BASE_NAME)
--with-xml2-config
--without-xml2-config
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
extconf failure: need libxml2.

Install the library or try one of the following options to extconf.rb:

  --with-xml2-config=/path/to/xml2-config
  --with-xml2-dir=/path/to/libxml2
  --with-xml2-lib=/path/to/libxml2/lib
  --with-xml2-include=/path/to/libxml2/include
To see why this extension failed to compile, please check the mkmf.log which can be found here:

/Users/stefanosugbit/.rvm/gems/ruby-2.5.0/extensions/x86_64-darwin-18/2.5.0/libxml-ruby-3.1.0/mkmf.log

extconf failed, exit code 1

Gem files will remain installed in /Users/stefanosugbit/.rvm/gems/ruby-2.5.0/gems/libxml-ruby-3.1.0 for inspection.
Results logged to /Users/stefanosugbit/.rvm/gems/ruby-2.5.0/extensions/x86_64-darwin-18/2.5.0/libxml-ruby-3.1.0/gem_make.out

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

In Gemfile:
right_aws_api was resolved to 0.3.5, which depends on
right_cloud_api_base was resolved to 0.2.6, which depends on
libxml-ruby
4

1 回答 1

1

您需要在 Ubuntu 16.04 上安装操作系统依赖项示例

 sudo apt install libxml2 libxml2-dev
于 2019-10-11T19:07:31.443 回答