【问题标题】:Uncaught exception: cannot load such file -- v8 on Linux未捕获的异常:无法加载此类文件——Linux 上的 v8
【发布时间】:2019-10-10 15:24:09
【问题描述】:

尝试将 Rails 从 5.2.0 升级到 5.2.3 比我想象的要难。我在应用程序启动期间面临Uncaught exception: cannot load such file -- v8

如果将mini_racer 替换为therubyracer,应用程序会启动,但会抛出ExecJS::RubyRacerRuntime is not supported. Please replace therubyracer with mini_racer in your Gemfile or use Node.js as ExecJS runtime.

我安装了nodejs,我的Gemfile 如下:

source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }

ruby '2.3.3'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.3'
# Use mysql as the database for Active Record
gem 'mysql2', '>= 0.4.4', '< 0.6.0'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0', '> 5.0.6'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '>= 1.3.0'
# See https://github.com/rails/execjs#readme for more supported runtimes
# gem 'mini_racer', platforms: :ruby

# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '~> 4.2'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.5'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '~> 3.1.7'

# Use ActiveStorage variant
# gem 'mini_magick', '~> 4.8'

# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development


# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.1.0', require: false

gem 'cancancan', '~> 2.0'
gem 'devise'
gem 'rack-attack', '~> 5.4.2'

gem 'autoprefixer-rails'
gem 'jquery-rails'
gem 'less-rails-semantic_ui'

gem 'libv8'
gem 'mini_racer'

gem 'faraday'
gem 'mailgun-ruby', '~>1.1.6'
gem 'retriable'
gem 'stripe'

# gem 'prometheus_exporter'
gem 'prometheus-client'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end

group :development do
  gem 'listen', '>= 3.0.5', '< 3.2'
  # Debug on RubyMine
  gem 'debase'
  gem 'ruby-debug-ide', '0.7.0.beta4'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring'
  gem 'spring-watcher-listen', '~> 2.0.0'
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
end

group :development, :test do
  gem 'factory_girl_rails'
  gem 'pry'
  gem 'rspec-rails'
end

group :test do
  gem 'selenium-webdriver'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
  gem 'database_cleaner'
  gem 'rack-test'
end

是我还是 JS 运行时环境看起来真的很乱。到处都有很多问题,人们在不知道发生了什么的情况下获得了正确的版本组合,使事情正常进行。

欢迎提出任何建议。谢谢。

【问题讨论】:

  • 明确地说,您是说应用程序加载正常;那么您更改的only (???) 是升级rails,然后出现上述错误?我问是因为如果您无意中升级了其他十几个东西,我们可能很难帮助诊断问题。你能不能显示一个 minimal Gemfile.lock diff 来引入错误?

标签: javascript ruby ruby-on-rails-5 gemfile


【解决方案1】:

这只是一个尝试:

  1. gem 'web-console', '>= 3.3.0' 更改为 gem "web-console"
  2. gem 'spring-watcher-listen', '~> 2.0.0' 变成 gem 'spring-watcher-listen'
  3. gem "mini_racer",平台::ruby`

【讨论】:

    猜你喜欢
    • 2019-11-20
    • 2018-11-12
    • 1970-01-01
    • 1970-01-01
    • 2016-12-17
    • 2013-08-30
    • 2019-06-07
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多