[Labs] Ruby on Rails: There was an error while trying to load the gem ‘uglifier’. (Bundler::GemRequireError)

Kasus:

Menginstall Ruby on Rails di Linux Mint dengan spek berikut,

$ rails -v
Rails 4.2.6
$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-linux]
$ sqlite3 –version
3.8.2 2013-12-06 14:53:30 27392118af4c38c5203a04b8013e1afdb1cebd0d

Kemudian muncul error pada saat menyalakan server dengan perintah $bin/rails server

/usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:80:in `rescue in block (2 levels) in require’: There was an error while trying to load the gem ‘uglifier’. (Bundler::GemRequireError)
from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:76:in `block (2 levels) in require’
from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `each’
from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:72:in `block in require’
from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `each’
from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler/runtime.rb:61:in `require’
from /usr/local/lib/ruby/gems/2.3.0/gems/bundler-1.11.2/lib/bundler.rb:99:in `require’
from /home/mintku/Documents/code/blog/config/application.rb:7:in `<top (required)>’
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `require’
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:78:in `block in server’
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `tap’
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:75:in `server’
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands/commands_tasks.rb:39:in `run_command!’
from /usr/local/lib/ruby/gems/2.3.0/gems/railties-4.2.6/lib/rails/commands.rb:17:in `<top (required)>’
from /home/mintku/Documents/code/blog/bin/rails:9:in `require’
from /home/mintku/Documents/code/blog/bin/rails:9:in `<top (required)>’
from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `load’
from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/rails.rb:28:in `call’
from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client/command.rb:7:in `call’
from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/client.rb:30:in `run’
from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/bin/spring:49:in `<top (required)>’
from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `load’
from /usr/local/lib/ruby/gems/2.3.0/gems/spring-1.7.2/lib/spring/binstub.rb:11:in `<top (required)>’
from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require’
from /usr/local/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require’
from /home/mintku/Documents/code/blog/bin/spring:13:in `<top (required)>’
from bin/rails:3:in `load’
from bin/rails:3:in `<main>’

Diantara beberapa solusi yang ditawarkan:

  1. Menginstall NodeJS
  2. Mengkonfigurasi Gemfile

Solusi yang dipakai pada dokumentasi ini adalah nomer 2, yaitu pada file Gemfile terdapat baris kode tentang gem ‘therubyracer’ yang masih dikomen, hilangkan komen dan coba jalankan lagi server.

lihat baris ke-15
lihat baris ke-15

Sekian.

Bacaan terkait:

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s