12
13

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 s が失敗してERROR RuntimeError: Missing `secret_key_base` と言われました。

Last updated at Posted at 2016-01-18

rails sしたら動かなくて困りました。

rails sでエラー

bundle exec rails s -b 0.0.0.0 -p 8888
=> Booting WEBrick
=> Rails 4.1.0 application starting in development on http://0.0.0.0:8888
=> Run `rails server -h` for more startup options
=> Notice: server is listening on all interfaces (0.0.0.0). Consider using 127.0.0.1 (--binding option)
=> Ctrl-C to shutdown server
[2016-01-17 14:07:02] INFO  WEBrick 1.3.1
[2016-01-17 14:07:02] INFO  ruby 2.1.0 (2013-12-25) [x86_64-linux]
[2016-01-17 14:07:02] INFO  WEBrick::HTTPServer#start: pid=1954 port=8888
[2016-01-17 14:07:08] ERROR RuntimeError: Missing `secret_key_base` for 'development' environment, set this value in `config/secrets.yml`
	/var/www/html/pugiemonn_app/vendor/bundle/ruby/2.1.0/gems/railties-4.1.0/lib/rails/application.rb:440:in `validate_secret_key_config!'
	/var/www

Missing secret_key_baseと書いてあります。

secrets.yml に secret_key_baseを書く

secrets.ymlが空だったので、developmentにsecret_key_baseを書くといいみたいでです。

vi config/secrets.yml

development:
  secret_key_base: aaaa

secret_key_baseを適当に入れました。

再度rails s

今度は動きました(๑•̀ㅂ•́)و✧

secret_key_base を生成する

コメントをいただいたようにsecret_key_baseを生成します。

bundle exec rake secret
598b5abb20fb110f686d8230765c1a72e1aac33f63c38646c1f3639e570c847a5b9ed0dd21f7c8797f2cd0859b1a5a3e5e179167f5c07372d005226159ce1a54

おお!!これを設定すればいいんですね(๑•̀ㅂ•́)و✧

参考

12
13
1

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
12
13

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?