ruby-on-rails - 未初始化常量 ExecJS::Runtimes::RubyRacerRuntime

标签 ruby-on-rails ruby therubyracer execjs

在我现有的项目中我改变了

gem "twitter-bootstrap-rails"

gem 'bootstrap', '~> 4.1.3'

在我的 Gemfile 中。我现在明白了

uninitialized constant ExecJS::Runtimes::RubyRacerRuntime

在线:<%= stylesheet_link_tag "application", :media => "all" %>app/views/layouts.html.erb

gem 文件:

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

ruby '2.5.1'

# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 5.2.0'
# Use mysql as the database for Active Record
gem 'mysql2'
# Use Puma as the app server
gem 'puma', '~> 3.11'
# Use SCSS for stylesheets
gem 'sass-rails', '~> 5.0'
# 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 'unicorn'

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
  # Access an interactive console on exception pages or by calling 'console' anywhere in the code.
  gem 'web-console', '>= 3.3.0'
  gem 'listen', '>= 3.0.5', '< 3.2'
  # 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'
end

group :test do
  # Adds support for Capybara system testing and selenium driver
  gem 'capybara', '>= 2.15', '< 4.0'
  gem 'selenium-webdriver'
  # Easy installation and use of chromedriver to run system tests with Chrome
  gem 'chromedriver-helper'
end

# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]


gem 'sidekiq'

gem 'paranoia', '~> 2.2'

gem 'console'

gem 'spreadsheet'

gem 'airbrake', '~> 6.2'

gem 'state_machines'
gem 'state_machines-activerecord'

gem 'devise-i18n'

gem 'devise'

gem 'paper_trail'

gem 'execjs'
gem "therubyracer"
#gem 'sprockets-rails', :require => 'sprockets/railtie'
gem "less-rails" #Sprockets (what Rails 3.1 uses for its asset pipeline) supports LESS
#gem "twitter-bootstrap-rails"

gem 'bootstrap', '~> 4.1.3'
#gem 'bootswatch'
#gem 'jquery-rails'

#gem 'devise-bootstrap-views', '~> 1.0'
#gem "font-awesome-rails"

gem "httparty"
gem "ruby-duration"
gem "jquery-rails"

gem 'webpacker', '~> 3.5'

#gem "spreadsheet"

rake about :

About your application's environment
Rails version             5.2.0
Ruby version              2.5.1-p57 (x86_64-linux)
RubyGems version          2.7.7
Rack version              2.0.5
JavaScript Runtime        therubyracer (V8)
Middleware                Webpacker::DevServerProxy, Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, RequestStore::Middleware, ActionDispatch::RemoteIp, Sprockets::Rails::QuietAssets, Rails::Rack::Logger, ActionDispatch::ShowExceptions, WebConsole::Middleware, ActionDispatch::DebugExceptions, Airbrake::Rack::Middleware, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActiveRecord::Migration::CheckPending, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ContentSecurityPolicy::Middleware, Rack::Head, Rack::ConditionalGet, Rack::ETag, Rack::TempfileReaper, Warden::Manager
Application root          /var/www/app
Environment               development
Database adapter          mysql2
Database schema version   20180831081336

gem list :

*** LOCAL GEMS ***

actioncable (5.2.1, 5.2.0)
actionmailer (5.2.1, 5.2.0)
actionpack (5.2.1, 5.2.0)
actionview (5.2.1, 5.2.0)
activejob (5.2.1, 5.2.0)
activemodel (5.2.1, 5.2.0)
activerecord (5.2.1, 5.2.0)
activestorage (5.2.1, 5.2.0)
activesupport (5.2.1, 5.2.0)
addressable (2.5.2)
airbrake (6.3.0)
airbrake-ruby (2.11.0)
archive-zip (0.11.0)
arel (9.0.0)
autoprefixer-rails (9.1.3)
bcrypt (3.1.12)
bigdecimal (default: 1.3.4)
bindex (0.5.0)
bootsnap (1.3.1, 1.3.0)
bootstrap (4.1.3)
bootswatch (4.1.3)
builder (3.2.3)
bundler (1.16.4, default: 1.16.2)
byebug (10.0.2)
capybara (3.7.0, 3.3.1)
childprocess (0.9.0)
chromedriver-helper (1.2.0)
cmath (default: 1.0.0)
coffee-rails (4.2.2)
coffee-script (2.4.1)
coffee-script-source (1.12.2)
commonjs (0.2.7)
concurrent-ruby (1.0.5)
connection_pool (2.2.2)
console (0.5)
crass (1.0.4)
csv (default: 1.0.0)
date (default: 1.0.0)
dbm (default: 1.0.0)
devise (4.5.0, 4.4.3)
devise-bootstrap-views (1.1.0)
devise-i18n (1.6.4)
did_you_mean (1.2.0)
erubi (1.7.1)
etc (default: 1.0.0)
execjs (2.7.0)
fcntl (default: 1.0.0)
ffi (1.9.25)
fiddle (default: 1.0.0)
fileutils (default: 1.0.2)
font-awesome-rails (4.7.0.4)
gdbm (default: 2.0.0)
globalid (0.4.1)
httparty (0.16.2)
i18n (1.1.0, 1.0.1)
io-console (default: 0.4.6)
io-like (0.3.0)
ipaddr (default: 1.2.0)
iso8601 (0.12.0)
jbuilder (2.7.0)
jquery-rails (4.3.3)
json (default: 2.1.0)
kgio (2.11.2)
less (2.6.0)
less-rails (2.8.0)
libv8 (3.16.14.19 x86_64-linux)
listen (3.1.5)
loofah (2.2.2)
mail (2.7.0)
marcel (0.3.2)
method_source (0.9.0)
mimemagic (0.3.2)
mini_mime (1.0.1, 1.0.0)
mini_portile2 (2.3.0)
minitest (5.11.3, 5.10.3)
msgpack (1.2.4)
multi_json (1.13.1)
multi_xml (0.6.0)
mysql2 (0.5.2, 0.5.1)
net-telnet (0.1.1)
nio4r (2.3.1)
nokogiri (1.8.4, 1.8.3)
openssl (default: 2.1.0)
orm_adapter (0.5.0)
paper_trail (10.0.1, 9.2.0)
paper_trail-association_tracking (1.0.0)
paranoia (2.4.1)
popper_js (1.14.3)
power_assert (1.1.1)
psych (default: 3.0.2)
public_suffix (3.0.3, 3.0.2)
puma (3.12.0, 3.11.4)
rack (2.0.5)
rack-protection (2.0.3)
rack-proxy (0.6.4)
rack-test (1.1.0, 1.0.0)
rails (5.2.1, 5.2.0)
rails-dom-testing (2.0.3)
rails-html-sanitizer (1.0.4)
railties (5.2.1, 5.2.0)
raindrops (0.19.0)
rake (12.3.1, 12.3.0)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
rdoc (default: 6.0.1)
redis (4.0.2, 4.0.1)
ref (2.0.0)
request_store (1.4.1)
responders (2.4.0)
ruby-duration (3.2.3)
ruby-ole (1.2.12.1)
ruby_dep (1.5.0)
rubygems-update (2.7.7)
rubyzip (1.2.2, 1.2.1)
sass (3.5.7, 3.5.6)
sass-listen (4.0.0)
sass-rails (5.0.7)
scanf (default: 1.0.0)
sdbm (default: 1.0.0)
selenium-webdriver (3.14.0, 3.13.0)
sidekiq (5.2.1, 5.1.3)
spreadsheet (1.1.8, 1.1.7)
spring (2.0.2)
spring-watcher-listen (2.0.1)
sprockets (3.7.2)
sprockets-rails (3.2.1)
state_machines (0.5.0)
state_machines-activemodel (0.5.1)
state_machines-activerecord (0.5.1)
stringio (default: 0.0.1)
strscan (default: 1.0.0)
test-unit (3.2.7)
therubyracer (0.12.3)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
twitter-bootstrap-rails (4.0.0)
tzinfo (1.2.5)
uglifier (4.1.18, 4.1.13)
unicorn (5.4.1, 5.4.0)
warden (1.2.7)
web-console (3.7.0, 3.6.2)
webpacker (3.5.5)
webrick (default: 1.4.2)
websocket-driver (0.7.0)
websocket-extensions (0.1.3)
xmlrpc (0.3.0)
xpath (3.1.0)
zlib (default: 1.0.0)

你知道如何解决这个问题吗?

最佳答案

我遇到了同样的问题,用 mini_racer 替换了 therubyracer gem,运行了 bundle install 并且现在正在工作。

这个修复在我的 Mac 和 Ubuntu 服务器上都适用

关于ruby-on-rails - 未初始化常量 ExecJS::Runtimes::RubyRacerRuntime,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52153092/

相关文章:

ruby-on-rails - 无法安装 therubyracer gem

ruby-on-rails - 安装 therubyracer 时出错

ruby-on-rails - Rails,与父对象一起创建关联记录?

ruby-on-rails - Rails 通过 before_action 设置局部变量,而不使用实例变量

ruby-on-rails - 如何输出到网站而不是控制台以在 Rails 中进行调试?

ruby-on-rails - `@count` 是 Ruby 中的实例变量还是类变量?

ruby - 方法闭包似乎在 therubyracer 中不起作用

ruby-on-rails - 在保存到数据库之前处理数据

ruby-on-rails - Rails 设计验证 IP 地址

ruby-on-rails - 如何使用 Chartkick 在 Rails 中混合柱形图和折线图?