LoginSignup
18

More than 3 years have passed since last update.

【Rails 6.0.0.rc2】rails s したら RAILS_ENV=development environment is not defined in config/webpacker.yml, falling back to production environment Exiting で怒られた。

Last updated at Posted at 2019-08-01

はじめに

〜本日(8/1)の朝〜


上司 「今日から開発をはじめるサービスはRails6を使うぞ!」

わたし (きたーーーーーーーーー!!ついにRails6だーーーーーーー!!)

わたし 「合点承知、すぐ取りかかるっす!!」

上司 「うむ、では開発よろしく。」


〜その後〜


わたし (Rails6の最新版はどれなのだろうか...検索、検索、ポチっとな...)

わたし 「...!!!!!!」

わたし 「うお、最新版、昨日リリースしてる!!!!!!!運命だ、これは運命だああああああ!!!」

Rails 6.0.0 rc2 released

わたし (さて、rails newしてbundle installしてrake db:createっと。)

わたし 「よし、問題なし! 喰らえ、rails s!!!」

わたし 「んんん?!?!見慣れないエラー!!!なんだこれは〜〜〜??????」


〜〜〜〜〜


というわけで、その際にした処置を記しておきます!

発生したエラー

$ bundle exec rails s

=> Booting Puma
=> Rails 6.0.0.rc2 application starting in development
=> Run `rails server --help` for more startup options
RAILS_ENV=development environment is not defined in config/webpacker.yml, falling back to production environment
Exiting
Traceback (most recent call last):
    68: from bin/rails:4:in `<main>'
~~~以下、省略~~~

解決策

$ bundle exec rails webpacker:install

はい!これでばっちし!

もう一度、rails sすると...

$ bundle exec rails s

=> Booting Puma
=> Rails 6.0.0.rc2 application starting in development
=> Run `rails server --help` for more startup options
Puma starting in single mode...
* Version 3.12.1 (ruby 2.6.3-p62), codename: Llamas in Pajamas
* Min threads: 5, max threads: 5
* Environment: development
* Listening on tcp://localhost:3000
Use Ctrl-C to stop

スクリーンショット 2019-08-01 12.01.49.png

\ Yay! You're on Rails! /

わたし 「やったああああああああああーーーーーーー!」

追記

yarnがインストールされていないと、以下のコマンドが失敗するようです。

$ bundle exec rails webpacker:install

その場合は

$ brew install yarn

でyarnをインストールしてあげてください!

※ 参考記事
Rubyの2.6とRails6のbetaが出たのでrails newした。

さいごに

ということで、無事にみんな大好きYay! You're on Rails!に出会えました。
もしみなさんが同様なエラーが出たときにお役に立てると幸いです。

それでは良きRailsライフを!!

わたしのtwitterアカウント

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
18