我是刚接触Ruby的新手,所以,如果出现问题,请更正我。我正在尝试将一个已经完成的项目部署到Linux服务器上。但是当我运行bundle install
时出现此错误:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /home/s161791/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rjb-1.5.5/ext
/home/s161791/.rbenv/versions/2.6.3/bin/ruby -I /home/s161791/.rbenv/versions/2.6.3/lib/ruby/2.6.0 -r ./siteconf20190625-22922-i0lxwv.rb extconf.rb
*** 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=/home/s161791/.rbenv/versions/2.6.3/bin/$(RUBY_BASE_NAME)
extconf.rb:53:in `<main>': JAVA_HOME is not set. (RuntimeError)
extconf failed, exit code 1
Gem files will remain installed in /home/s161791/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/rjb-1.5.5 for inspection.
Results logged to /home/s161791/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-linux/2.6.0-static/rjb-1.5.5/gem_make.out
An error occurred while installing rjb (1.5.5), and Bundler cannot continue.
Make sure that `gem install rjb -v '1.5.5' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
beardley-barcode was resolved to 1.0.1, which depends on
beardley was resolved to 1.4.2, which depends on
rjb-loader was resolved to 0.0.2, which depends on
rjb
据我了解,这与JAVA_HOME路径有关。它已经设置好了,我试图再次设置它,但是没有结果。
# echo $JAVA_HOME
/usr/lib/jvm/java-8-openjdk-amd64
# java -version
openjdk version "1.8.0_212"
OpenJDK Runtime Environment (build 1.8.0_212-8u212-b03-0ubuntu1.18.04.1-b03)
OpenJDK 64-Bit Server VM (build 25.212-b03, mixed mode)