rails server

estis2016/10/10 (月) 08:07 に投稿

rails server
すると、
 lib/ruby/gems/2.3.0/gems/bundler-1.13.2/lib/bundler/runtime.rb:94:in `rescue in block (2 levels) in require': There was an error while trying to load the gem 'uglifier'. (Bundler::GemRequireError)
Gem Load Error is: Could not find a JavaScript runtime. See https://github.com/rails/execjs for a list of available runtimes.
と言われた。

Gemfile で、
# gem 'therubyracer', platforms: :ruby
のコメントアウトを外して、
bundle install 。

−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

デフォルトでは、外部から接続できないので、
rails server -b 0.0.0.0
する。

rails server -h
Usage: rails server [mongrel, thin etc] [options]
    -p, --port=port                  Runs Rails on the specified port.
                                     Default: 3000
    -b, --binding=IP                 Binds Rails to the specified IP.
                                     Default: localhost
    -c, --config=file                Uses a custom rackup configuration.
    -d, --daemon                     Runs server as a Daemon.
    -e, --environment=name           Specifies the environment to run this server under (test/development/production).
                                     Default: development
    -P, --pid=pid                    Specifies the PID file.
                                     Default: tmp/pids/server.pid
    -C, --[no-]dev-caching           Specifies whether to perform caching in development.
                                     true or false

    -h, --help                       Shows this help message.

−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−

Cannot render console from [IPアドレス]! Allowed networks: 127.0.0.1, ::1, 127.0.0.0/127.255.255.255
と言われた。

config/environments/development.rb に、
config.web_console.whitelisted_ips = '0.0.0.0/0'
を追記。