2

In my existing project I changed

gem "twitter-bootstrap-rails"

to

gem 'bootstrap', '~> 4.1.3'

in my Gemfile. I'm getting now

uninitialized constant ExecJS::Runtimes::RubyRacerRuntime

on line: <%= stylesheet_link_tag "application", :media => "all" %> in app/views/layouts.html.erb

Gemfile:

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)

Do you have any idea how to fix this?

David
  • 825
  • 10
  • 33

2 Answers2

3

I had the same issue, replaced therubyracer gem with mini_racer ran bundle install and is working now.

This fix worked for me both in my Mac and on my Ubuntu server

  • Can confirm this also worked for me. Except I had to upgrade from Ruby 2.2.x to 2.3.x to use `mini_racer` (which was definitely needed!) – UsAndRufus Oct 17 '18 at 16:19
1

I'm having the same problem, with a shiny-new Rails 5.2.0 app.

As soon as I added the Bootstrap gem to the new project, I started to see that error in my continuous delivery builds. But it didn't affect my development. Not until I made a change to a .css asset file. Then I started to see this error in development also.

ec2-user:~/environment (master) $ rake about
About your application's environment
Rails version             5.2.0
Ruby version              2.4.1-p111 (x86_64-linux)
RubyGems version          2.6.14
Rack version              2.0.5
JavaScript Runtime        therubyracer (V8)
Middleware                Rack::Sendfile, ActionDispatch::Static, ActionDispatch::Executor, ActiveSupport::Cache::Strategy::LocalCache::Middleware, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, ActionDispatch::RemoteIp, Sprockets::Rails::QuietAssets, Rails::Rack::Logger, ActionDispatch::ShowExceptions, WebConsole::Middleware, ActionDispatch::DebugExceptions, 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
Application root          /home/ec2-user/environment
Environment               development
Database adapter          sqlite3
Database schema version   20180831204125

Gemfile:

source 'https://rubygems.org'


# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '5.2.0'
gem 'activesupport', '5.2.0'
# Use sqlite3 as the database for Active Record
gem 'sqlite3', '1.3.13'
# Use Puma as the app server
gem 'puma', '3.7'
# Use SCSS for stylesheets
gem 'sass-rails', '5.0.7'
# Use Uglifier as compressor for JavaScript assets
gem 'uglifier', '4.1.10'
# Use CoffeeScript for .coffee assets and views
gem 'coffee-rails', '4.2.2'
# See https://github.com/rails/execjs#readme for more supported runtimes
gem 'execjs', '~> 2.7.0'
gem 'therubyracer', platforms: :ruby

# Use jquery as the JavaScript library
gem 'jquery-rails', '4.3.3'
# 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.7.0'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '3.0'
# Use ActiveModel has_secure_password
# gem 'bcrypt', '3.1.7'
gem 'passenger', '5.2.3'
# gem 'therubyracer', '0.12.3'
# Use Capistrano for deployment
# gem 'capistrano-rails', group: :development

gem "simple_calendar", "~> 2.0"
gem 'bootstrap', '~> 4.1.3'

group :development, :test do
  # Call 'byebug' anywhere in the code to stop execution and get a debugger console
  gem 'byebug', platform: :mri
  gem 'rspec-rails', '3.7.2'
end

group :development do
  # Access an IRB console on exception pages or by using <%= console %> anywhere in the code.
  gem 'web-console', '3.6.2'
  gem 'listen', '3.0.5'
  # Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
  gem 'spring', '1.7.2'
  gem 'spring-watcher-listen', '2.0.0'
end

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

gem list:

ec2-user:~/environment (master) $ 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)
arel (9.0.0)
autoprefixer-rails (9.1.3)
bigdecimal (default: 1.3.0)
bindex (0.5.0)
bootstrap (4.1.3)
bootstrap-sass (3.3.7)
builder (3.2.3)
bundler (1.16.3)
bundler-unload (1.0.2)
byebug (10.0.2)
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)
crass (1.0.4)
did_you_mean (1.1.0)
diff-lcs (1.3)
erubi (1.7.1)
execjs (2.7.0)
executable-hooks (1.5.0)
ffi (1.9.25)
gem-wrappers (1.3.2)
globalid (0.4.1)
i18n (1.1.0)
io-console (default: 0.4.6)
jbuilder (2.7.0)
jquery-rails (4.3.3)
json (default: 2.0.2)
less (2.6.0)
less-rails (2.8.0)
libv8 (3.16.14.19 x86_64-linux)
listen (3.0.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)
mini_portile2 (2.3.0)
minitest (5.11.3, 5.10.1)
multi_json (1.13.1)
net-telnet (0.1.1)
nio4r (2.3.1)
nokogiri (1.8.4)
openssl (default: 2.0.3)
passenger (5.2.3)
popper_js (1.14.3)
power_assert (0.4.1)
psych (default: 2.2.2)
puma (3.7.0)
rack (2.0.5)
rack-test (1.1.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)
rake (12.3.1, 12.0.0)
rb-fsevent (0.10.3)
rb-inotify (0.9.10)
rdoc (default: 5.0.0)
ref (2.0.0)
rspec-core (3.7.1)
rspec-expectations (3.7.0)
rspec-mocks (3.7.0)
rspec-rails (3.7.2)
rspec-support (3.7.1)
rubygems-bundler (1.4.5)
rvm (1.11.3.9)
sass (3.5.7)
sass-listen (4.0.0)
sass-rails (5.0.7)
simple_calendar (2.3.0)
spring (1.7.2)
spring-watcher-listen (2.0.0)
sprockets (3.7.2)
sprockets-rails (3.2.1)
sqlite3 (1.3.13)
test-unit (3.2.3)
therubyracer (0.12.3)
thor (0.20.0)
thread_safe (0.3.6)
tilt (2.0.8)
turbolinks (5.0.0)
turbolinks-source (5.2.0)
twitter-bootstrap-rails (4.0.0)
tzinfo (1.2.5)
uglifier (4.1.10)
web-console (3.6.2)
websocket-driver (0.7.0)
websocket-extensions (0.1.3)
xmlrpc (0.2.1)
Ryan Porter
  • 1,982
  • 1
  • 11
  • 17
  • 2
    Based on the comment above from barnacle.m, I upgraded autoprefixer-rails to the version that was released today: https://rubygems.org/gems/autoprefixer-rails That did NOT solve the problem. Still experimenting with gem versions... – Ryan Porter Sep 04 '18 at 16:01
  • I couldn't fix it by playing with gem versions. My final fix: I don't need Less, so I removed less-rails from my Gemfile. – Ryan Porter Sep 04 '18 at 16:10