LoginSignup
2
0

More than 3 years have passed since last update.

bin/rails sしたら「`require': Could not load the 'ecto' Active Record adapter. Ensure that the adapter is spelled correctly in config/database.yml and that you've added the necessary adapter gem to your Gemfile.」と言われなんのことだかわからず発狂しそうになったが解決できた話

Last updated at Posted at 2020-03-16

はじめに

  • 昨日まで動いていたRailsのプロジェクトが動かなくなりました
  • なにもしていないことはなくて、バッチリなにかをしていました
  • が、まさかそんなところに影響がでるとはおもわず、右往左往した話です
`require': Could not load the 'ecto' Active Record adapter. 
Ensure that the adapter is spelled correctly in config/database.yml and 
that you've added the necessary adapter gem to your Gemfile.
  • こんなエラーがでました
    • 指示通り、config/database.ymlをみても不審な点は見当たりません
    • ectoです
    • ecto です
    • ectoPhoenixでのなにかが影響しているのだろうなあとはおもいましたが、なかなかわかりませんでした
  • 私は、Ruby on RailsElixirのWebアプリケーションフレームワークPhoenixをよく使っています

結論

なぜ追加したの?

export DATABASE_URL=ecto://USER:PASS@HOST/database
  • Yay!

  • ~/.zshenv~/.bashrc~/.bash_profile等に追加している場合は、環境変数DATABASE_URLを消してターミナルを立ち上げ直してください

    • DATABASE_URLを消したあとに、source ~/.zshenvなんてやっても、しぶとくDATABASE_URLは残っていますから!
    • いわれてみればその通りなのですが、DATABASE_URLが怪しいと気づいたあとでも老い先短い人生の時間を浪費してしまいました
  • Could not load the 'ecto' Active Record adapter. は私がググった限りはでてこなかったので、ここに記しておきます

2
0
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
2
0