![如何在 ubuntu 上安装 [email protected]?](https://linux22.com/image/947405/%E5%A6%82%E4%BD%95%E5%9C%A8%20ubuntu%20%E4%B8%8A%E5%AE%89%E8%A3%85%20%5Bemail%20protected%5D%EF%BC%9F.png)
我是 Linux 新手,正在尝试在工作中安装 ruby on rails 应用程序。现在,Gemfile 想要安装 therubyracer。
运行时bundle install
失败:
Fetching therubyracer 0.12.3
Installing therubyracer 0.12.3 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /root/.rbenv/versions/2.5.8/lib/ruby/gems/2.5.0/gems/therubyracer-0.12.3/ext/v8
/root/.rbenv/versions/2.5.8/bin/ruby -r ./siteconf20220613-666-1d8cum5.rb extconf.rb --with-v8-dir=/usr/local/opt/[email protected]
checking for -lpthread... yes
checking for v8.h... 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
--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=/root/.rbenv/versions/2.5.8/bin/$(RUBY_BASE_NAME)
--with-pthreadlib
--without-pthreadlib
--enable-debug
--disable-debug
--with-v8-dir
--with-v8-include
--without-v8-include=${v8-dir}/include
--with-v8-lib
--without-v8-lib=${v8-dir}/lib
/root/.rbenv/versions/2.5.8/lib/ruby/gems/2.5.0/gems/libv8-3.16.14.19/ext/libv8/location.rb:50:in `configure': By using --with-system-v8, you have chosen to use the version
(Libv8::Location::System::NotFoundError)
of V8 found on your system and *not* the one that is bundled with
the libv8 rubygem.
However, your system version of v8 could not be located.
Please make sure your system version of v8 that is compatible
with 3.16.14.19 installed. You may need to use the
--with-v8-dir option if it is installed in a non-standard location
from /root/.rbenv/versions/2.5.8/lib/ruby/gems/2.5.0/gems/libv8-3.16.14.19/lib/libv8.rb:7:in `configure_makefile'
from extconf.rb:32:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/root/.rbenv/versions/2.5.8/lib/ruby/gems/2.5.0/extensions/aarch64-linux/2.5.0/therubyracer-0.12.3/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /root/.rbenv/versions/2.5.8/lib/ruby/gems/2.5.0/gems/therubyracer-0.12.3 for inspection.
Results logged to /root/.rbenv/versions/2.5.8/lib/ruby/gems/2.5.0/extensions/aarch64-linux/2.5.0/therubyracer-0.12.3/gem_make.out
An error occurred while installing therubyracer (0.12.3), and Bundler cannot continue.
Make sure that `gem install therubyracer -v '0.12.3' --source 'https://rubygems.org/'` succeeds before bundling.
如您所见checking for v8.h... no
,无法找到v8.h
文件。这是因为它依赖于 v8 引擎,而我不确定如何在 Ubuntu:18.04 上安装它。
我正在尝试使用 Dockerfile 进行此设置。
这是我的 Dockerfile:
FROM ubuntu:18.04
RUN apt update
RUN apt install -y git curl libssl-dev libreadline-dev zlib1g-dev autoconf bison build-essential libyaml-dev libreadline-dev libncurses5-dev libffi-dev libgdbm-dev libpq-dev libcurl4-openssl-dev python software-properties-common
RUN apt update
RUN curl -fsSL https://github.com/rbenv/rbenv-installer/raw/HEAD/bin/rbenv-installer | bash
RUN git clone https://github.com/rbenv/ruby-build.git
ENV PATH="/root/.rbenv/bin:${PATH}"
RUN rbenv install 2.5.8
ENV PATH="/root/.rbenv/versions/2.5.8/bin:${PATH}"
RUN eval "$(rbenv init -)"
RUN gem install bundler:1.17.3
RUN bundle config build.therubyracer --with-v8-dir=/usr/local/opt/[email protected]
RUN bundle config build.libv8 --with-system-v8
COPY . /opt/myapp
WORKDIR /opt/myapp
# RUN bundle install
ENTRYPOINT ["tail", "-f", "/dev/null"]
运行后docker exec -it my_image
,然后bundle install
,我收到上述错误。
这是我的 Gemfile:
source "https://rubygems.org"
git_source(:github) do |repo_name|
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?("/")
"https://github.com/#{repo_name}.git"
end
ruby "2.5.8"
gem "oj"
gem "coffee-rails", "~> 4.2"
gem "loofah", "~> 2.9.0"
gem "puma", "~> 5.6.4"
gem "rails", "~> 5.2.7"
gem "rails-html-sanitizer", "~> 1.0.4"
gem "sass-rails", "~> 5.1.0"
gem "turbolinks", "~> 5"
gem "uglifier", ">= 1.3.0"
gem "bcrypt", "~> 3.1.7"
gem "execjs"
gem "jsonapi-serializers"
gem "jwt"
gem "newrelic_rpm", "~> 6.12", ">= 6.12.0.367"
gem "rack-cors", "~> 1.0.4", require: "rack/cors"
gem "redis"
gem "redis-mutex"
gem "redis-rails"
gem "simple_command"
gem "therubyracer"
gem "will_paginate", "~> 3.1.7"
# yanked v0.3.5
gem "mimemagic", github: "mimemagicrb/mimemagic", ref: "01f92d86d15d85cfd0f20dabd025dcbd36a8a60f"
gem "activeadmin_json_editor", "~> 0.0.7"
gem "awesome_print"
gem "aws-sdk-cloudwatch"
gem "aws-sdk-sqs"
gem "capistrano-sidekiq", group: :development
gem "committee"
gem "config"
gem "dotenv-rails"
gem "foreman"
gem "geocoder", "~> 1.6.1"
gem "high_voltage"
gem "http", "~> 5.0.1"
gem "jquery-rails"
gem "leaderboard"
gem "materialize-sass"
gem "memory_profiler"
gem "oink", "~> 0.10.1"
gem "pg", "~> 0.20"
gem "rspec-core", "~> 3.7.1"
gem "rswag"
gem "rubocop", "~> 0.81", require: false
gem "rubocop-performance", "~> 1.5.2", require: false
gem "rubocop-rails", "~> 2.4.2", require: false
gem "sidekiq", "5.2.10"
gem "sidekiq-scheduler"
gem "strong_migrations"
gem "tzinfo-data", platforms: %i[mingw mswin x64_mingw jruby]
# for ether scan address formatting
gem "digest-sha3"
gem "rlp"
group :development, :test do
gem "byebug", platforms: %i[mri mingw x64_mingw]
gem "capybara", "~> 2.13"
gem "selenium-webdriver"
end
group :development do
gem "letter_opener", "1.6.0"
gem "listen", ">= 3.0.5", "< 3.2"
gem "spring"
gem "spring-watcher-listen", "~> 2.0.0"
gem "web-console", ">= 3.3.0"
end
group :development do
gem "better_errors"
gem "capistrano"
gem "capistrano-bundler"
gem "capistrano-passenger", ">= 0.1.1"
gem "capistrano-rails"
gem "capistrano-rvm"
gem "guard-bundler"
gem "guard-rails"
gem "guard-rspec"
gem "rails_layout"
gem "rb-fchange", require: false
gem "rb-fsevent", require: false
gem "rb-inotify", require: false
gem "rb-readline"
gem "spring-commands-rspec"
end
group :development, :test do
gem "factory_bot_rails"
gem "faker"
gem "pry"
gem "rspec-rails"
gem "webmock", "~> 3.13.0"
end
group :test do
gem "database_cleaner"
gem "launchy"
gem "rails-controller-testing"
gem "rspec-sidekiq"
gem "shoulda-matchers"
gem "simplecov", "~> 0.17.1", require: false
end
gem "pusher"
gem "activeadmin", "~> 2.9.0"
gem "activeadmin_addons", "~> 1.7.1"
gem "active_admin_role", "~> 0.2.2"
gem "audited", "~> 4.10.0"
gem "carrierwave", "~> 1.3.2"
gem "devise", "~> 4.7.1"
gem "fog-aws", "~> 3.3.0"
gem "mini_magick"
gem "pg_search", "~> 2.3", ">= 2.3.2"
gem "rotp"
gem "tinymce-rails"
# dynamodb
gem "dynamoid"
gem "activerecord-import", "~> 1.0.1"
gem "bootsnap", require: false
gem "bundler-audit", "~> 0.7.0.1"
gem "device_detector"
gem "karafka"
gem "phonelib", "~> 0.6.44"
gem "sentry-rails"
gem "slack-notifier"
group :development do
gem "brakeman", "~> 4.10.0"
gem "bullet"
end
group :development, :test, :staging do
gem "active_record_query_trace"
end
# parallel rspec
gem "parallel_tests", group: %i[development test]
# cloudflare
gem "cloudflare-rails", "~> 2.0.0", group: %i[production staging testing]
gem "makara", "~> 0.5.1"
gem "distribute_reads", "~> 0.3.4"
gem "multiverse", "~> 0.2.2"
gem "nokogiri", ">= 1.12.5"
gem "elastic-apm", group: %i[production staging]
gem "ddtrace", require: "ddtrace/auto_instrument"
gem "rails_semantic_logger"
有人能帮我解决这个问题吗?帮我了解如何使用 Docker 安装 v8 引擎?我试过了apt install libv8-dev
。apt 无法找到 libv8-dev。
我可以安装[电子邮件保护]在 Mac 上使用 brew :。brew install [email protected]
我如何安装[电子邮件保护]在 ubuntu docker 上?