15
14

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 が失敗して`raise_no_secret_key': Devise.secret_key was not setと言われました。

15
Last updated at Posted at 2016-01-18

githubの某リポジトリをクローンして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
Exiting
/var/www/html/pugiemonn_app/vendor/bundle/ruby/2.1.0/gems/devise-3.2.4/lib/devise/rails/routes.rb:481:in `raise_no_secret_key': Devise.secret_key was not set. Please add the following to your Devise initializer: (RuntimeError)

Devise.secret_key was not set.と書いてあります。

config.secret_key のコメントを外す

config/initializers/devise.rbにある、config.secret_keyを有効にすると良いみたいです。

vi config/initializers/devise.rb 

config.secret_key = 'f16010379bf12db8fd95a9d247deda7d6e732134e80275155f222db2c6d35 .. 略'

config.secret_keyはコメントになっていたのでコメントを外しました。

再度rails s

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

参考

15
14
0

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
15
14

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?