90
79

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

rails server で There was an error while trying to load the gem 'uglifier'.と言われる解決方法。

Last updated at Posted at 2015-12-17

rails new したばかりのプロジェクトを rails new できない問題の解決方法です。

rails serverが失敗する

serverが立ち上がらない
bundle exec rails s -b 0.0.0.0

/home/vagrant/.rbenv/versions/2.2.4/lib/ruby/gems/2.2.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)
略

Vagrant 内なので -b オプションをつけています。

therubyracer のコメントを外す

Gemfileを編集
vi Gemfile

gem 'therubyracer', platforms: :ruby

therubyracer を有効にします。

bundle install

いくつか gem が入ります。

Installing libv8 3.16.14.13
Installing ref 2.0.0
Installing therubyracer 0.12.2 with native extensions

再度rails s

bundle exec rails s -b 0.0.0.0 -p 8888
=> Booting WEBrick
=> Rails 4.2.5 application starting in development on http://0.0.0.0:8888
=> Run `rails server -h` for more startup options
=> Ctrl-C to shutdown server
[2015-12-16 23:58:36] INFO  WEBrick 1.3.1
[2015-12-16 23:58:36] INFO  ruby 2.2.4 (2015-12-16) [x86_64-linux]
[2015-12-16 23:58:36] INFO  WEBrick::HTTPServer#start: pid=16358 port=8888

今度はうまくいきました(☝ ՞ਊ ՞)

90
79
3

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
90
79

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?